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.

When I press Ctrl+/ in a graphical terminal (e.g. xterm) I get "undo". However, in a virtual terminal (e.g. Ctrl+Alt+F1) I get "backspace".

In practice I run into this when I'm using emacs in a virtual terminal, probably debugging some X problem, and I try to use C+/ to undo but instead get a backspace.

I believe I have experienced this on multiple computers over the years, so I don't think it's very specific to my current setup (ubuntu).

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

When you press a key in xterm, it sends a character sequence that is determined by the translations in its X resources. Typically Ctrl+/ sends the single character ^_ (i.e. character number 31, like Ctrl+_). The shell interprets this control character as the undo command.

When you press the key in a Linux console, it sends a character sequence that is determined by the active keymap. The command loadkeys loads a keymap. The location of the default keymap depends on the distribution and on the installed packages; on recent Ubuntu distributions, the console keymap is derived from the default XKB keymap. Many default keymap assign Backspace (which is called Delete in this context: it's character 127) to Ctrl+/ (I don't know why); you can change this by using the following keymap fragment:

keycode  53 = slash            question        
        control keycode  53 = Control_underscore
        alt     keycode  53 = Meta_slash      
        shift   alt     keycode  53 = Meta_question   

If you have a file called /etc/console/boottime.kmap.gz, edit that. If you have a file /etc/default/keyboard, read it and follow the instructions.

share|improve this answer
    
Thanks! I have /etc/default/keyboard. I'm using XKBOPTIONS there, and I don't want to maintain a full separate keymap, so I'm looking for a more modular solution. Loading the keymap fragment you give above with sudo loadkeys <file with keymap fragment> works for the current session, and I guess I could run that from an init.d script. –  ntc2 Jul 20 '12 at 2:09
    
@enoksrd Right, you can use an init.d script, or even add loadkeys </etc/enoksrd/custom.kmap to /etc/rc.local. –  Gilles Jul 20 '12 at 2:16
add comment

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.