-
Notifications
You must be signed in to change notification settings - Fork 0
Bash command line shortcuts
monstruooo edited this page Feb 12, 2018
·
17 revisions
Ctrl + a to the beginning of the line
Ctrl + e to the end of line
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b One word back
Alt + f one word forward
Ctrl + t swap characters
Alt + t swap words
Ctrl + k – delete from cursor to the end of the command line.
Ctrl + u – delete from cursor to the start of the command line.
Ctrl + h delete character back
Ctrl + d delete next character
Ctrl + w delete to the previous white space
Alt + Backspace delete previous word
Alt + d delete next word
Ctrl + y paste
Alt + y until the next deleted word you need. You need first paste with c+y, and then keep rotating the ring with Alt+y until you hit the word you are looking for
ctrl + - Undo
Alt + r Restore the entire line (If you started from a history command)
Alt + [0-9] Repeat the command that follows [0-9] times
Esc + # escape the entire line
Ctrl + s Search history forward *
* Run stty -ixon to disable tty flow control.
* You can put this command into .bashrc
Put this in your ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\C-p": history-search-backward
"\C-n": history-search-forward
Type something, then pressing Ctrl-p(or Ctrl-n) will initiate the search in the history with the already typed text as prefix