In terminal emulation applications, pressing CTRL + Left / Right arrows jumps from one word to the previous or next one. Is it possible to have the same functionality in a Linux console, whether it is in text or in framebuffer modes?
In my configuration, the CTRL + arrow keys are transformed into escaped character sequences and not interpreted.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Emacs-style shortcuts Alt + f, Alt + b work by default with all readline-powered command line programs, like shells.
Method 2
This is possible if and only if the terminal sends different escape sequences for Ctrl+Left vs Left. This is not the case by default on the Linux console (at least on my machine). You can make it so by modifying the keymap. The exact file to modify may depend on your distribution; on Debian lenny, the file to modify is /etc/console/boottime.kmap.gz. You need lines like
control keycode 105 = F100 string F100 = "33O5D" control keycode 106 = F101 string F101 = "33O5C"
You might as well choose the same escape sequences as your X terminal emulator. To find out what the control sequence is, type Ctrl+V Ctrl+Left in a shell; this inserts (on my machine) ^[O5D where ^[ is an escape character. In the keymap file, 33 represents an escape character.
Configuring the application in the terminal to decode the escape sequence is a separate problem, .
Method 3
You can set vim as your command line editor and then hit ESC and jump around vim style (forward, back, end, $, 0, etc)
Method 4
This is not with control + arrows, but I can type Esc B
to go back a word and Esc F to go forward a word in my Mac Terminal.
Method 5
I had this issue on Debian with an empty ~/.inputrc file. Fixed the problem by removing this file.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0