Skip to content

Instantly share code, notes, and snippets.

@newtonapple
Created April 7, 2009 17:57
Show Gist options
  • Save newtonapple/91361 to your computer and use it in GitHub Desktop.
Save newtonapple/91361 to your computer and use it in GitHub Desktop.
Bash key binding and shortcuts
# CURSOR MOVEMENT
ctrl-a # go to beginning of the line
ctrl-e # go to end of the line
ctrl-x # (2 times) to remember current cursor location and move to the previous cursor location
# cycle this command to move between current and previous cursor location
ctrl-c # leave current line intact, and move cursor to a new line (return but don't execute command)
ctrl-j/ctrl-m # (less useful) return and execute command
esc-b # move cursor one WORD to the left
esc-f # move cursor one word to the right
ctrl-b # (less useful) move cursor one char to the left
ctrl-f # (less useful) move cursor one char to the right
# CUT & PASTE
ctrl-w # cut word to the left of cursor (or cut till the beginning of a word)
ctrl-u # cut everything to the left of cursor (cut to beginning of line)
ctrl-k # cut everything to the right of cursor (cut to end of line)
ctrl-y # paste cut item
# DELETE
ctrl-h # delete one characters to the left of cursor
ctrl-d # delete one character to the right of cursor (current char)
# SCREEN
ctrl-l # (cmd-k on Mac) to clear screen
cmd-= # (Mac only), zoom in / bigger fonts
cmd-- # (Mac only), zoom out / smaller fonts
# COMMAND HISTORY
ctrl-i/tab # (2 times) to list all available command matching what's been typed.
# When there's only one possibility, (1 time) will auto complete.
ctrl-r # open up string match for your command history ( reverse-i-search )
ctrl-p # replace line with last typed command (multiple times will traverse up command history)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment