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

Mother dropped some tea in the keyboard and as a result of that the shift key died.I mean it is always on. I researched and found out that there is a comand to solve that:

xmodmap -e 'keycode 50 = NoSymbol'

so I open terminal and copy paste. Works Perfect.

The only problem is that on startup the order is gone and it is trcky to "teach her" how to do it again.So i like to fix it forever without having to go to the terminal everytime I start the computer...It has been 2 weeks without restarting...:-)

I read a couple of post about "expect " command but could not figure it out.

share|improve this question
You don't need to involve a terminal at all. Just run the command at the right time. What release of Ubuntu does that computer run? – Gilles Jun 26 '12 at 23:21

This may be a bad response, but have you tried outputting the command in the program "Startup Applications"? I had to do that for Conky to start upon login.

share|improve this answer
Unfortunately, this will not work until the user logs in. The "Startup Applciations" are run when you log in, not when Ubuntu starts up. – Aaron Hill Jun 26 '12 at 23:09
@Aaron This command needs to be run when the X server runs. Compt's answer is mostly right, but it won't handle the login screen. – Gilles Jun 26 '12 at 23:16

To do this, press AltF2, and type in gksudo gedit /etc/init.d/ You will be prompted to enter in your password, and then the Gedit Text Editor will appear. Juts add the following two lines of code to the file, and save it with Control-S.



xmodmap -e 'keycode 50 = NoSymbol'

When Ubuntu starts up, the command you use will be run automatically. The !#/bin/bash line tells Ubuntu to use the Bash shell (information about Bash can be found here)

share|improve this answer

To execute a script at startup of Ubuntu

Edit /etc/rc.local and add your commands
The script must always end with exit 0 


share|improve this answer
That won't work. The command needs to be executed after the X server starts. /etc/rc.local can't help here. Also, I wouldn't trust a source that claims that /etc/rc.local must end with exit 0, this is not at all necessary. – Gilles Jun 26 '12 at 23:18

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.