Bash Cheat Sheet (standard Emacs mode)

Updated . Posted . Visible to the public.
  • Ctrl + R Search commands you entered previously. Press Ctrl + R again to search further back, Ctrl + Shift + R searches forward again.

  • Ctrl + W Deletes from the cursor position to the left.

  • Ctrl + _ Undo. Yes, this also works with a German keyboard layout.

  • Ctrl + L Clear screen.

  • Ctrl + D Close shell. ( EOT Show archive.org snapshot , just like in many other shells.) Note: if you dove into another shell (e.g. with sudo su username) you will close it and return to the previous one.

  • !! Repeat the previous command. Can be used inside other commands, e.g.: "sudo !!" (← don't do that mindlessly!)

  • !$ Access the last argument of the previous command. Example: Check with "ls foo*" first and call "mv !$ /tmp" afterwards.

Combined commands

Ctrl + (C P O) Cancel the running command, go to the Previous command and run it.


Add useful keyboard shortcuts or shell commands if you think they are missing.

Note that you can also use your bash in VI mode!

Arne Hartherz
Last edit
Judith Roth
Keywords
linux, unix
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2010-11-03 08:54)