Suppose I have the following line in my command prompt and the cursor is at the and of the line or the beginning of the line by using (CTRL+A)

[subhrcho@slc04lyo pcbpel]$ abc def ghi jkl

How can I navigate to a particular word say, for example, to def. I am using tcsh shell in linux with default binding which I suppose is emacs mode.

P.S:I do not have a Meta key in my keyboard. I can move forward or backward between words by using CTRL+f and respectively. So I think my Meta key is the Esc key. Please correct me if that presumption is wrong. Alt isn't working either as the meta key.I had a look at the emacs documentation but invoking CTRL-s w and then pressing Enter is not working for me. It would just try to execute whatever is there in the prompt by first appending a w character to it and the prompt would say :

[subhrcho@slc04lyo pcbpel]$ abc def ghi jklw
abc: Command not found.

1 Answer 1


By Meta-x tcsh means that it expects the ESC ASCII character (aka ^[ or \e) followed by x. You can always do it by pressing Escape and x quickly in sequence, or some terminals do it by pressing Alt-x.

Some other terminals send the character x with the 8th bit set when pressing Alt-x. With xterm, you can change that by adding:

XTerm*metaSendsEscape: true

to an X11 resource file.

Now, for searching in tcsh, if you want to emulate emacs/zsh Ctrl-R or Ctrl-S in emacs mode, you'll have to bind the i-search-back and i-search-fwd widgets:

bindkey '^R' i-search-back
bindkey '^S' i-search-fwd

However note that generally, for the terminal driver, ^S is the stop character that pauses the terminal input and output (resumed with ^Q). So, if you want to bind ^S, you'll have to disable that either by disabling flow control:

stty -ixon

Or bind stop to some other character:

stty stop '^T'
  • But CTRL+R also searches through the history command. I find it pretty useful and would like to retain that behavior. In that scenario if I do bindkey '^R' i-search-back, will the default behavior not get get overridden?
    – Geek
    Aug 7, 2013 at 7:16
  • Also how can I make these bindings persist between sessions?
    – Geek
    Aug 7, 2013 at 7:17
  • @Geek, i-search-back is to search through the history (starting with the current line). In the tcsh implementation I have access to, ^R is bound to redisplay. Add those in ~/.tcshrc to make persistent. Ever thought of running man tcsh? Aug 7, 2013 at 7:37
  • Where can I find a list of available widgets? I tried man bash but there is no section for bindkey. Also I searched online and found this website: ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/… but there is no mention of i-search-back . Apr 12, 2018 at 0:47
  • @Sergio, in tcsh, use bindkey -l. In bash, use bind -l Apr 15, 2018 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .