How to Use the XMODMAP Command in Linux to Swap Keyboard Keys

|

We all like to play jokes on others from time to time, and some of the best jokes happen to be computer related. This is one of them, for those using Linux operating system.


Step 1 Wait until your friend or family member is away from her computer and open a Shell window.

Step 2 First, you need look at the keycode mapping on the computer, so you will know what keycodes to use for the swap. Type this command: xmodmap –pk. This will allow you to view the list and will normally list the keycode on the left with the key it represents in parentheses.

Step 3 Once you find the correct keycode for the letters you want to swap, you will need to get into the user’s .bashrc file. To do this, use the command: gedit .bashrc.

Step 4 Next you will need to add the xmodmap commands to the end of the file. For example, if you would like to switch the user’s “a” key with the “s” key, and the keycode list showed A=73 and S=91, then you would add these commands to the file:
Xmodmap –e ‘keycode 91 = a A’
Xmodmap –e ‘keycode 73 = s S’

Step 5 Save the changes you have made by using the :w command and close the Shell window. Then wait for the user to try to use the “a” and “s” key, only to think that he has forgotten how to type correctly.

0 comment:

Post a Comment

 

©2009 computer technology World | Template Blue by TNB