Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I followed some post a while ago, and it said to make an ~/.xmodmap file like so:

! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

I did, and it now I can swap esc and caps lock by doing xmodmap ~/.xmodmap. I wanted this to be permanent, so I added that command to my ~/.bash_profile, but it doesn't seem to work; I still have to manually xmodmap. As an EEng dropout, I am tempted to just rewire my keyboard }:-) but I know there must be a better way. How can I make this work, permanently?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Execute xfce4-settings-manager, in Session and Startup -> Application autostart, add an entry, which executes xmodmap ~/.xmodmap

Or rename the file to ~/.Xmodmap

share|improve this answer
I renamed the file (it worked!), but I am surprised that my .bash_profile method didn't work. I thought my bash-fu was not weak :P –  Dan Ross Mar 4 '13 at 18:23

Using the .Xmodmap didn't work for me.

However, a quick man xmodmap says that this works and did:


which can be executed:

xmodmap .xmodmaprc

EDIT: ack...I'm wrong...the default did change a few years ago to .Xmodmap from .xmodmaprc. Creating the .Xmodmap file caused my xfce to load "funny". In .bash_profile, I put:

xmodmap .xmodmaprc

Then it worked, and I have a script that restarted my Xfce so it all works.

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.