Possible Duplicate:
How to make xinput settings persist after devices are unplugged, replugged, and after shutdown, restart, etc?

How can I run the terminal command sudo xinput set-button-map "Logitech Unifying Device. Wireless PID:101b" 1 10 3 4 5 6 7 8 9 2 at every startup?


2 Answers 2


This command affects the GUI, so it must be executed after the GUI is set up. If you can live without your custom mouse button assignment on the login screen, add the command to your startup applications. Don't use sudo, it isn't useful here (and in fact might not work).

With a Gnome interface, the startup applications are in "System > Preferences > Startup Applications". With the Unity interface, they are in "Applications > Other > Startup Applications". See Adding program to session startup in the Ubuntu community documentation for more details.

  • 1
    It worked! In Startup Application I used the command without "sudo" and it worked!
    – user118993
    Jan 5, 2013 at 15:39

Use Upstart.

description     "Configuring Logitech Unifying Device"


# Start when a user logs in graphically
start on desktop-session-start

stop on runlevel [016]

console output

exec xinput set-button-map "Logitech Unifying Device. Wireless PID:101b" 1 10 3 4 5 6 7 8 9 2

The script should be placed in /etc/init/logitech-unifying-device.conf You can use a different name as long as extension is .conf.

I assumed that it is wireless device. However you can exec command on any event you find to be suitable. For details see Upstart Cookbook.

  • That is not true. One of the great advantages of the Upstart is that script can be tuned to run on desired event(s). In this case it might be desktop-session-start. See Run a Job When a User Logs in Graphically. Jan 5, 2013 at 16:49
  • You are right: I was focused on the fact that it is a wireless device neglecting xinput command but I clearly stated that it can be executed on any suitable event. :) Jan 5, 2013 at 17:12

Not the answer you're looking for? Browse other questions tagged .