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?

  • 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


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)
  • 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

  • 2
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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