{"id":47441,"date":"2024-10-28T12:09:10","date_gmt":"2024-10-28T12:09:10","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=47441"},"modified":"2025-12-08T07:00:25","modified_gmt":"2025-12-08T07:00:25","slug":"disable-side-buttons-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/10\/disable-side-buttons-ubuntu\/","title":{"rendered":"Disable Mouse Side Buttons in Ubuntu 24.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-47442\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p><b>This tutorial shows how to disable your mouse forward\/backward buttons in Ubuntu. Though the title said for Ubuntu 24.04, this tutorial should also work in most modern Linux, such as Debian, Fedora, and Arch.<\/b><\/p>\n<p>Many mouses today have extra buttons on the side, allowing to navigate forward and back when working with web browsers, file explorers, etc applications.<\/p>\n<p>If you don&#8217;t like the side-buttons, like me, then you can disable them in Linux.<\/p>\n<p>Without using third-party apps (e.g., <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2021\/07\/remap-keyboard-gamepad-ubuntu\/\" target=\"_blank\" rel=\"noopener\">input-remapper<\/a>), here I&#8217;m going to show you how to do the job by creating an <a href=\"https:\/\/wiki.archlinux.org\/title\/Udev\" target=\"_blank\" rel=\"noopener\">udev rule<\/a> that works in most Linux on both Xorg and Wayland sessions.<\/p>\n<div id=\"attachment_47443\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn.webp\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-47443\" class=\"size-large wp-image-47443\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn-700x396.webp\" alt=\"\" width=\"610\" height=\"345\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn-700x396.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn-300x170.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn-768x435.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/mouse-side-btn.webp 1200w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-47443\" class=\"wp-caption-text\">A Mouse with side buttons<\/p><\/div>\n<p><!--more--><\/p>\n<h3>Step 1: Find out scancodes of the Mouse buttons<\/h3>\n<p>When you press a button on mouse, it sends a <b>scancode<\/b> to the computer. Then, your system maps the scancode to a virtual <b>keycode<\/b>. By re-mapping the <code>scancode<\/code> to <code>reserved<\/code>, it will be ignored when you press on it.<\/p>\n<p>1. First, press <code>Ctrl+Alt+T<\/code> to open up a terminal window. When it opens, run command:<\/p>\n<pre>evtest<\/pre>\n<p>Or <code>sudo evtest<\/code> if it cannot discover any of input devices.<\/p>\n<p>If command not found, run <code>sudo apt install evtest<\/code> to install. And in the terminal output, it will print all the available input devices.<\/p>\n<p>In my case, it&#8217;s a wireless keyboard connected through an USB receiver. As the screenshot below shows, it should be either <code>\/dev\/input\/event6<\/code> or <code>\/dev\/input\/event8<\/code>. Type either number 6 or 8 (you need to replace it accordingly), then continue.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/evtest-mouse.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47444\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/evtest-mouse-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/evtest-mouse-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/evtest-mouse-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/evtest-mouse.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>2. After typing the correct device event number and hitting Enter, it should print corresponding outputs in terminal window, when you moving and\/or pressing buttons on the mouse.<\/p>\n<p>Now, you need to press the side-buttons, and remember the value number (scancode) in terminal output.<\/p>\n<p>In my case, when I clicked on forward button, it output scancode <b>90005<\/b> and keycode <b>BTN_EXTRA<\/b>. And, it output <b>90004<\/b> and <b>BTN_SIDE<\/b> when backward button clicked.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47445\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick-700x457.webp\" alt=\"\" width=\"610\" height=\"398\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick-700x457.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick-300x196.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick-768x502.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/detect-sideclick.webp 779w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>Step 2: Get the ID of your mouse<\/h3>\n<p>After finding out the scancodes of side-buttons, you also need to find out the ID of the mouse, so you can tell Linux kernel which device to configure when writing the udev rule.<\/p>\n<p>This can be done by running a single command below in terminal:<\/p>\n<pre>cat \/sys\/class\/input\/event6\/device\/modalias<\/pre>\n<p><b>Here you need to replace &#8220;event6&#8221; in command with yours device event number<\/b>, according to <code>evtest<\/code> command in Step 1.<\/p>\n<p>In the output, you need to copy the <b>input:b****v****p****e****<\/b> (<code>input:b0003v089Dp062Fe0111<\/code> in my case). And,<\/p>\n<ul>\n<li><code>input<\/code> is the Kernel subsystem name.<\/li>\n<li><code>b0003<\/code> means bus ID 0003.<\/li>\n<li><code>v089Dp062Fe0111<\/code> are the 4-digit hex <b>v<\/b>ender, <b>p<\/b>roduct, and v<b>e<\/b>rsion ID.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/get-mouse-modalias.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47446\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/get-mouse-modalias-700x254.webp\" alt=\"\" width=\"610\" height=\"221\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/get-mouse-modalias-700x254.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/get-mouse-modalias-300x109.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/get-mouse-modalias.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>Step 3: Create &amp; Edit udev rule<\/h3>\n<p>Now, in a terminal window, run command to create and open a custom udev rule:<\/p>\n<pre>sudo gnome-text-editor \/etc\/udev\/hwdb.d\/71-mouse-local.hwdb<\/pre>\n<p>Depends on your desktop environment, replace <code>gnome-text-editor<\/code> with <code>gedit<\/code> for 22.04 and earlier, <code>mousepad<\/code> for XFCE, <code>pluma<\/code> for MATE, or <code>nano<\/code> command line text editor that works in most desktops.<\/p>\n<p>When file opens, add the lines below and edit accordingly:<\/p>\n<pre>evdev:<b>input:b0003v089Dp062Fe0111<\/b>*\r\n KEYBOARD_KEY_<b>90005<\/b>=reserved\r\n KEYBOARD_KEY_<b>90004<\/b>=reserved<\/pre>\n<p>Here, you need to:<\/p>\n<ul>\n<li>replace <code>90005<\/code> and <code>90004<\/code> according to Step 1.<\/li>\n<li>replace <code>input:b0003v089Dp062Fe0111<\/code> according to Step 2.<\/li>\n<\/ul>\n<p><b>NOTE: there&#8217;s an asterisk * at the end of first line.<\/b> For nano text editor, press Ctrl+S to save and Ctrl+X to exit.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47447\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns-700x368.webp\" alt=\"\" width=\"610\" height=\"321\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns-700x368.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns-300x158.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns-768x404.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/10\/udev-mouse-sidebtns.webp 921w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>Tips: for mouse works in both wireless and wired modes, each mode may have its own product ID. Meaning, you may have to do the steps above twice! And, the udev rule will look like:<\/b><\/p>\n<pre>evdev:input:b0003v25A7pFA7<b>C<\/b>e0110*\r\n KEYBOARD_KEY_90005=reserved\r\n KEYBOARD_KEY_90004=reserved\r\n\r\nevdev:input:b0003v25A7pFA7<b>B<\/b>e0110*\r\n KEYBOARD_KEY_90005=reserved\r\n KEYBOARD_KEY_90004=reserved<\/pre>\n<h3>Step 4: Apply Change<\/h3>\n<p>After saved the udev config file, you can either restart computer, or run the 2 commands below one by one to apply change:<\/p>\n<ul>\n<li>First, update the binary hardware database\n<pre>sudo systemd-hwdb update<\/pre>\n<\/li>\n<li>Then apply the change.\n<pre>sudo udevadm trigger \/dev\/input\/event*<\/pre>\n<p>You may skip <code>\/dev\/input\/event*<\/code> in last command, \u00a0<code>sudo udevadm trigger<\/code> also works.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-43965\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev-600x158.webp\" alt=\"\" width=\"600\" height=\"158\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev-600x158.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev-300x79.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev-768x202.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/05\/update-udev.webp 779w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>Undo &#8211; Re-enable side-buttons<\/h3>\n<p>To undo the changes above, just delete the udev config file via the command below, and <b>restart computer<\/b>:<\/p>\n<pre>sudo rm \/etc\/udev\/hwdb.d\/71-mouse-local.hwdb<\/pre>\n<p>If you don&#8217;t want to restart, then, re-edit the config file and replace <b>reserved<\/b> according to Step 1, one with <b>BTN_EXTRA<\/b>, and another with <b>BTN_SIDE<\/b>. Finally, re-run the 2 commands in Step 4 to apply.<\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to disable your mouse forward\/backward buttons in Ubuntu. Though the title said for Ubuntu 24.04, this tutorial should also work in most modern Linux, such as Debian, Fedora, and Arch. Many mouses today have extra buttons on the side, allowing to navigate forward and back when working with web browsers, file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":47442,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2236,2235],"class_list":["post-47441","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-input","tag-mouse"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=47441"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47441\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/47442"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=47441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=47441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=47441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}