Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ubuntu 11.10

First off, I'm completely new to Linux, as in I just partitioned my computer two days ago and installed Ubuntu. My tab key recently quit on me, and I would rather swap the caps lock and tab since they are in the same vicinity. I tried following this post;

How to swap/remap the CAPS LOCK key with Tab key?

but I am unable to run

xmodmap keycode  66 = Tab ISO_Left_Tab Tab ISO_Left_Tab
xmodmap:  unable to open file 'keycode' for reading
xmodmap:  unable to open file '66' for reading
xmodmap:  unable to open file '=' for reading
xmodmap:  unable to open file 'Tab' for reading
xmodmap:  unable to open file 'ISO_Left_Tab' for reading
xmodmap:  unable to open file 'Tab' for reading
xmodmap:  unable to open file 'ISO_Left_Tab' for reading
xmodmap:  7 errors encountered, aborting.

then when I tried to edit usr/bin/xmodmap, I get encoding errors in Gedit.

Any help??

share|improve this question
    
I ran: xmodmap keycode 66 = Tab ISO_Left_Tab Tab ISO_Left_Tab –  clofal Feb 1 '12 at 5:39
    
correct syntax: xmodmap -e "keycode 66 = Tab ISO_Left_Tab Tab ISO_Left_Tab" –  clofal Feb 1 '12 at 5:42
    
Second question, will this revert back on reboot? –  clofal Feb 1 '12 at 5:43
    
Yes, it will revert on loging out and back in , you do not need to reboot. See the original question for how to make it persistent across sessions. –  bodhi.zazen Feb 1 '12 at 7:16
    
I updated my first post on the other answer, thank you for pointing out my mistake. –  bodhi.zazen Feb 1 '12 at 7:47

2 Answers 2

If you manouvre to your home directory using Nautilus, press Ctrl+H to show hidden files.

Then locate the file .bashrc -- files or folder starting with a . are automatically hidden. In that file, add the line

xmodmap -e "keycode 66 = Tab ISO_Left_Tab Tab ISO_Left_Tab"

as mentioned in the comment to your question. Then save the file.

No effect will occur until you run a terminal. Once you have just opened the terminal window, the effect will occur. Further, it will revert on boot, but calling a terminal window will re-activate.

share|improve this answer

To create instructions for xmodmap which get processed every time you login you will need to create a file called .Xmodmap file in your home directory. You can do this using the following command from terminal

echo keycode 66 = Tab ISO_Left_Tab Tab ISO_Left_Tab > ~/.Xmodmap

Next time you login the new keymapping will take effect. If you want to to work immediately use the following command from terminal:

xmodmap ~/.Xmodmap

Hope that helps.

share|improve this answer

Your Answer

 
discard

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.