Server Fault is a question and answer site for system and network administrators. 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 do a lot of shell scripting in linux (running xmonad window manager, so I can use xmodmap or xinput, but not GNOME or KDE control panels), and it would be super useful for a shift-space keystroke to output an underscore ("_") character. Any ideas how to do this?

share|improve this question
up vote 7 down vote accepted

The following xmodmap expression will map Shift+Space to underscore. Add this to ~/.Xmodmaprc and run xmodmap ~/.Xmodmaprc during startup to make it persistent.

xmodmap -e 'keycode 65 = space underscore space'
share|improve this answer

Have you been through keymap, loadkeys, etc - . It's the same idea but for the kernel and the keyboard driver. You should be able to take your present layout and just add a couple of lines.

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.