Skip to content

Instantly share code, notes, and snippets.

@0xadada 0xadada/
Last active Jun 16, 2016

What would you like to do?
Bash movement, keyboard commands and shortcuts

Bash Cheatsheet

Movement, keyboard commands and shortcuts for the GNU Bourne-Again SHell.


Command Keyboard Character
caps lock
arrow up
arrow down
arrow left
arrow right
escape or
return/enter or
page up
page down


  • ⌃a - Beginning of line (Home)
  • ⌃e - End of line (End)
  • ⎇b - Back one word
  • ⎇f - Forward one word
  • ⌃xx - Toggle between the start of line and current cursor position
  • ⌃f - Forward one character
  • ⌃b - Backward one character


  • ⌃l - Clear the screen
  • ⌃w - Delete the Word before the cursor
  • ⎇d - Delete the Word after the cursor
  • ⎇⌫ - Delete the Word before the cursor
  • ⌃u - Cut the text before the cursor
  • ⌃k - Cut the text after the cursor
  • ⌃k - Cut the text after the cursor
  • ⇧Insert - Paste at the cursor
  • ⌃⇧<codepoint> - Insert unicode character at cursor

Command History

  • , ⌃p - Previous command
  • , ⌃n - Next command
  • ⌃r - Search previous command history mode
  • ⌃g - Escape from Search previous history mode
  • !! - Repeat last command

Note on Login vs Non-login Shells

There is much confusion about how .bashrc and .bash_profile are read. This article explains the issue.

To summarize: A login shell means that you got the shell after authenticating to the system, usually by giving your user name and password. Files read:


A non-login shell means that you did not have to authenticate to the system. For instance, when you open a terminal using an icon, or a menu item, that is a non-login shell. Files read:


For this reason, to unify the environments between both login and non-login shells, the .bashrc file should source the .bash_profile file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.