Skip to content

Instantly share code, notes, and snippets.

@diasjorge
Created February 15, 2012 18:48
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diasjorge/1838101 to your computer and use it in GitHub Desktop.
Save diasjorge/1838101 to your computer and use it in GitHub Desktop.
Efficient bash cheat sheet
Efficient moving
Ctrl-a Move to the start of the line.
Ctrl-e Move to the end of the line.
Ctrl-b Move back one character.
Alt-b Move back one word.
Ctrl-f Move forward one character.
Alt-f Move forward one word.
Ctrl-u Delete from the cursor to the beginning of the line.
Ctrl-k Delete from the cursor to the end of the line.
Ctrl-w Delete from the cursor to the start of the word.
Alt-d Delete from the cursor to the end of the word.
Esc-Backspace Delete previous word
Ctrl-y Pastes text from the clipboard.
Ctrl-l Clear the screen leaving the current line at the top of the screen.
Ctrl-x Ctrl-u / Ctrl-_ Undo the last changes.
Alt-r Undo all changes to the line.
Ctrl-] x Where x is any character, moves the cursor forward to the next occurance of x.
Transformations
Alt-u Upcase to the end of the word.
Alt-c Capitalize to the end of the word.
Alt-l Downcase to the end of the word.
Ctrl-t Transpose the current letter with the previous one.
Alt-t Transpose the current word with the previous one.
History
Ctrl-r Search your history backwards (can be executed incrementally).
Ctrl-p Previous command in history (can be executed incrementally).
Ctrl-n Next command in history (can be executed incrementally).
Esc-. Last argument for the last command (can be executed incrementally).
!$ Last argument for the last command
!! Last command executed
!NUMBER Command NUMBER on the history
!KEY Last command beginning with KEY
VI mode
Use at your own risk
"set -o vi" to your ~/.bashrc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment