Last day, one of my friends was doing some stuff on its Mac OSX Term without using any shortcuts. I suggest some of them (which are POSIX, GNU or Shell keys combinations) to him and he answer me : Why don’t you post it on shell-tips.com ?!
Those shortcuts are for Bash shell but it’s probably work with other advance shells.
Control Keys combinations (CTRL+KEY)
- ctrl+a : move your cursor to the beginning of the line
- ctrl+e : move your cursor to the end of the line
- ctrl+k : delete any characters from your cursor to the end of the line
- ctrl+u : delete any characters from your cursor to the beginning of the line
- ctrl+w : delete previous word
- ctrl+t : transpose two previous characters
- ctrl+y : yank/recover the last deletion
- ctrl+d : delete one character at the cursor position
- ctrl+h : delete one character before the cursor
- ctrl+f : move forward (or use the right arrow ! :-)
- ctrl+b : move backward (or use the left arrow ! :-)
- ctrl+r : find character sequence in history (completion mode)
- ctrl+g : escape from completion mode
- ctrl+v : Literal next (LNEXT)
NB: LNEXT interpret the next character as a string. eg : for symbolize a CR+LF you must do the key combination ctrl+v+return, that will print ^M.
Escape Keys combinations (ESC+KEY)
- esc+d : delete from the cursor position to the end of the word
- esc+f : move forward a word
- esc+b : move backward a word
- esc+t : transpose two adjacent words
Other common keys
- Use up/down arrows to move thru the bash command history
- Use left/right arrows to move on the current line
- Use tabulation key (TAB) for auto-complete a command name or a file name
- Use exclamation key + command name for repeat last similar command (ex. : !vi will recall the last vi command)
Enjoy ! ;-)