Bash shortcuts

Duration 10 min
Difficulty Easy
 

Navigate

  • CTRL+a go to the start of the line (equivalent to "home" key)
  • CTRL+e go to the end of the line (equivalent to "end" key)
  • CTRL+f move forward by one character (equivalent to arrow to the right)
  • CTRL+b move backward by one character (equivalent to arrow to the left)
  • ALT+f move forward by one word
  • ALT+b move backward by one word

Edit

  • CTRL+h delete the character before the cursor (equivalent to backspace)
  • CTRL+d delete the character after the cursor
  • CTRL+k delete all characters after the cursor
  • CTRL+u delete all characters before the cursor
  • CTRL+w delete the word before the cursor
  • CTRL+y undelete (uncut)

Transform

  • CTRL+t swap the last two characters
  • ALT+t swap the last to words
  • ALT+u – put all characters in a word after the cursor in uppercase.
  • ALT+l – put all characters in a word after the cursor in lowercase.

Replay (History)

  • CTRL+r search a line in history (reverse order)
  • CTRL+s search a line in history
  • CTRL+g exit search mode without running the command
  • CTRL+n display the next line in history
  • CRTL+p display the previous line in history
  • CTRL+o run the line found in history

Control

  • CTRL+c stop the currently running program
  • CTRL+z interrupts the running program (can be put in bg and brought back with fg)
  • CTRL+l clear the screen but keep the current command
  • CTRL+[ equivalent to the ESC key
  • CTRL+i equivalent to TAB
  • CTRL+j new line
  • CTRL+m same as return key

Recipe published on 2019-01-22