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 ssh into one of our servers, I cannot enter a forward slash character, which makes it difficult to do pretty much anything (like ls /). How can I get the forward slash to work?

Some additional information:

  • /etc/issue claims it's running "CentOS release 5.7 (Final)"
  • The only way I know this is by running ssh me@some-host cat /etc/issue
  • I'm using Mac OS X Terminal.app, and I've never had trouble with this, on Centos 5 systems or otherwise
  • I don't know who or how the machine was built and set up
  • echo $TERM reports xterm-256color
  • i don't know if this makes sense to anyone (it doesn't make sense to me), but i diff'ed the /etc/inputrc of the malfunctioning server with one that works and got the following:

    $ diff /tmp/{good,bad}_inputrc
    1c1
    < # do not bell on tab-completion
    ---
    > /# do not bell on tab-completion
    37a38,49
    > 
    > # Home Key
    > "\e[7~":beginning-of-line
    > 
    > # End Key
    > "\e[8~":end-of-line
    > 
    > # Delete Key
    > "\e[3~":delete-char
    > 
    > # Insert Key
    > "\e[2~":paste-from-clipboard
    
share|improve this question
1  
If you press ctrl + v then /, does it work? –  Patrick Apr 2 '12 at 3:38
    
yes, that does work –  aaronstacy Apr 2 '12 at 14:15

2 Answers 2

This line is your problem

/# do not bell on tab-completion

If I add that line to my working config, slash stops working.

The only clue that I can find about this is in the readline man page:

Blank lines are ignored. Lines beginning with a # are comments. Lines beginning with a $ indicate conditional constructs. Other lines denote key bindings and variable settings.

Since it's not a blank line, and doesn't begin with # or $, it must be being treated as a key binding.

share|improve this answer
    
Nice catch. Completely missed that :-) –  Patrick Apr 2 '12 at 12:03

A program called xmodmap can be used to modify keymaps. See man xmodmap if it's already installed.

In a nutshell, use xev to see details about X events. Fire that up, and strike your / key. On my setup this is the result I get:

KeyRelease event, serial 34, synthetic NO, window 0x4e00001,
root 0x15a, subw 0x0, time 107752919, (784,828), root:(789,850),
state 0x10, keycode 61 (keysym 0x2f, slash), same_screen YES,
XLookupString gives 1 bytes: (2f) "/"
XFilterEvent returns: False

Then, on the remote machine, use xmodmap -e 'keycode [KEYCODE] = [KEYSYM] to create the mapping, where [KEYCODE] and [KEYSYM] are the values retrieved from xev. Try setting the default 61,0x2f first to see if it just needs to be reset. (i.e., xmodmap -e 'keycode 61 = 0x2f')

If that's a no-go, try mapping a different key. For example, I tried keycode 105 (right control) to 0x2f. That worked locally and in an ssh session for me.

Edit:

You may also want to set the question mark. Extend the previous command to xmodmap -e 'keycode 61 = 0x2f 0x3f'. You can see a complete list of keysyms here.

share|improve this answer
1  
xmodmap doesn't matter here, as X is not being used. –  Renan Apr 2 '12 at 11:28

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.