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 have the file ~/.xmodmap where i swap a few keys on my keyboard. This file was loaded properly on my previous Ubuntu desktop but since the upgrade to 12.04 it's no longer loaded when I login to my desktop.

What's the proper way to execute commands when we login to the desktop in ubuntu 12.04?

share|improve this question
Try putting the xmodmap command in with the rest of your startup apps. – Chan-Ho Suh Apr 18 '12 at 8:11

search for "startup applications" in your dash. -Click on add -Name it and enter the command you want to execute -Click ok and restart to verify

share|improve this answer

Use "greeter-setup-script" and "session-setup-script" with Lightdm in /etc/lightdm/lightdm.conf.

The greeter-setup-script option runs the script (as root) before login.

greeter-setup-script = (Script to run when starting a greeter)

The session-setup script runs the script (as root) after login.

session-setup-script = (Script to run when starting a user session)
share|improve this answer
This answer is my favorite, but doesn't seem to work on Ubuntu Mate... saaad :( – user568021 Apr 16 '15 at 10:26

Actually there is a way to execute user specific commands during boot up time. The commands or scripts that we want to execute should be added to the script /etc/rc.local

The script /etc/rc.local will be similar to a shell script. Make sure it's exit status is 0, add the following line to that script "exit 0".

This /etc/rc.local script is executed at the end of each multiuser runlevel.

Thanks & Regards,

M Ram Murthy

share|improve this answer
This answer is incorrect. rc.local is a shell script, and is executed outside of the X environment, and indeed as root, so it won't work for this requirement. – Robin Green Aug 28 '12 at 12:28

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.