Turn mouse acceleration off on Ubuntu or any other Linux PC

Tux mouseI must admit that I'm no gamer. Actually the only game I play occasionally is Urban Terror FPS. I don't want to spend those 15 minutes a month playing at the end of TAB key players list. Recently I've discovered that my gaming improves when I turn the mouse acceleration off. So lets talk about how to do this in Linux operating system. I'm not talking about gnome-mouse-properties because when you use GUI to turn the mouse acceleration off it doesn't really gets turned off, it is only reduced. In this article I will show you how to turn your mouse acceleration completely off. Follow me...

First we will list all input devices on your PC because we want to pinpoint your mouse and kill the mouse acceleration with surgical precision, only for the mouse device you use to play. We can list all connected USB devices like this:

xinput list

This is an example of this commands output:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse              	id=9	[slave  pointer  (2)]
⎜   ↳ Wacom Bamboo1 stylus                    	id=10	[slave  pointer  (2)]
⎜   ↳ Wacom Bamboo1 eraser                    	id=12	[slave  pointer  (2)]
⎜   ↳ Wacom Bamboo1 cursor                    	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ LITEON Technology USB Multimedia Keyboard	id=8	[slave  keyboard (3)]
    ↳ UVC Camera (046d:09a4)

My mouse is listed as "Logitech USB Optical Mouse" with id=9. We will use this id to get current mouse properties like this:

xinput list-props 9

This is an example of default mouse properties for my Logitech mouse:

Device 'Logitech USB Optical Mouse':
	Device Enabled (117):	1
	Coordinate Transformation Matrix (119):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (244):	0
	Device Accel Constant Deceleration (245):	2.000000
	Device Accel Adaptive Deceleration (246):	1.000000
	Device Accel Velocity Scaling (247):	10.000000
	Evdev Reopen Attempts (237):	10
	Evdev Axis Inversion (248):	0, 0
	Evdev Axes Swap (250):	0
	Axis Labels (251):	"Rel X" (127), "Rel Y" (128)
	Button Labels (252):	"Button Left" (120), "Button Middle" (121), "Button Right" (122), "Button Wheel Up" (123), "Button Wheel Down" (124), "Button Horiz Wheel Left" (125), "Button Horiz Wheel Right" (126), "Button Side" (239), "Button Extra" (240), "Button Forward" (241), "Button Back" (242), "Button Task" (243), "Button Unknown" (238), "Button Unknown" (238), "Button Unknown" (238), "Button Unknown" (238)
	Evdev Middle Button Emulation (253):	2
	Evdev Middle Button Timeout (254):	50
	Evdev Wheel Emulation (255):	0
	Evdev Wheel Emulation Axes (256):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (257):	10
	Evdev Wheel Emulation Timeout (258):	200
	Evdev Wheel Emulation Button (259):	4
	Evdev Drag Lock Buttons (260):	0

Here is contents of BASH script I use to turn my mouse acceleration off:

xinput set-prop 'Logitech USB Optical Mouse' 'Device Accel Profile' -1
xinput set-prop 'Logitech USB Optical Mouse' 'Device Accel Constant Deceleration' 2

The best approach is to save this script as something like mouseacc.sh inside ~/bin directory because this directory is inside your PATH environment variable and you can call scripts from this directory from anywhere in your file system. You can just hit Alt+F2 and enter mouseacc.sh to turn mouse acceleration off for selected device. Don't forget to set executable bit for your script because without this your script will refuse to do its work. This is how you can achieve this:

chmod +x ~/bin/mouseacc.sh

That's it my friends. Wish you all good gaming on your Linux PC.


A quality focused Magento specialized web development agency. Get in touch!

7 thoughts on “Turn mouse acceleration off on Ubuntu or any other Linux PC

  1. Ramón

    Do you know what “Device Accel Adaptive Deceleration” is?

    Even if I set it to 1 or 100, I can’t see any difference.

    And… are you really having a better performance on Urban Terror with those changes?
    I have mouse acceleration disabled and low sensitivity on my OS (Linux of course) but I’m not seeing any changes ingame at all.
    Urban Terror (ioquake3 actually) have its own variables to configure those settings (sensitivity and cl_mouseAccel) and I think Urban Terror is ignoring all the external settings.

    1. Marko Author

      About parameters description you can read more here. I must admit I don’t understand all of it and I don’t believe that tweaking it all can do miracles for your gaming performance. Remembering the times when I did a lot of gaming makes me think that you just need to get used to one setting and then you’re good. Making it possible to adjust this on Linux is great if you’re used to some other settings and need to replicate this on your Linux box 🙂

      1. inf3rno

        +1, it is a peace of cr*p. In windows I wasn’t able to turn it off by G400. I tried out every available accelfix, but still nothing. By Linux it’s now tuned off, thanks! 🙂

        Note: you should use the id instead of the device name by turning it off. E.g. by me it is called as “Logitech Gaming Mouse G400”.

        1. inf3rno

          It is possible to fine tune the sense. You have to set the DPI to max with your mouse buttons (if it has such buttons. if not then I don’t know how to do that), and change the constant deceleration. I initially thought that it is an integer, but it appears to be a float value, and I was able to set the proper sensitivity with the value of 1.5. maybe later I set it to more accurate, but it’s fine for now. Thanks the post!

  2. N

    Hi there,

    I know this is an old post, but if anybody still checks this, I have a question.

    Is there a Linux command that will tell me what the current DPI is on my mouse?

    I used RazerCFG on a previous Ubuntu install to reduce the high mouse sensitivity on my Razer DeathAdder Black Edition. But now I’m trying to figure out whether those settings were saved directly onto my mouse or not. Or if it just feels slower because I have the pointer speed turned all the way down in System Settings.



Leave a Reply

Your email address will not be published. Required fields are marked *