Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm an Ubuntu 13.04 user and I'm trying to run a script at startup. I created it in /etc/init.d/, gave it chmod 755 and ran the update-rc.d <your script> defaults command. The script is remapping my mouse's keybindings and contains the following:

#! /bin/sh
xinput set-button-map 10 1 2 3 4 5 6 7 9 8

It runs correctly if I do it manually, but I want it to run with startup.

share|improve this question
up vote 3 down vote accepted

Wouldn't that run it before there's an X Server around for it to interface with?

The simplest way to get this to work would just be to add sh -c "xinput set-button-map 10 1 2 3 4 5 6 7 9 8" to your start-up applications and that'll run it when you log in.

There's also /etc/xdg/autostart for all users, into which you can write .desktop files (look at the existing ones for syntax help).

share|improve this answer

If you add scripts to the rc.d it will start before the Xserver or xorg is up, also it will apply from the root user perspective. The most preferable place to do this is /etc/X11/xinit/xinput.d/ for system wide X start up scripts or ~/.xinputrc for users based ones.

For this you should install im-config (it should be the default in Ubuntu) and add your script in that folder or file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.