CHEATSHEET: Terminal Keyboard Shortcuts
published on Thu Mar 26 2020As a web developer, I spend a significant amount of time typing terminal commands when I’m not writing source code in my favourite editor. And keyboard shortcuts in the terminal differ significantly from keyboard shortcuts in my favourite code editor (😍 VS Code 😍).
I’ve listed here the keyboard shortcuts I find useful:
Cursor Movement
Ctrl + a
- move cursor to the beginning of the line. I use theHome
key for thisCtrl + e
- move cursor to the end of the line. I use theEnd
key for thisCtrl + f
- move cursor forward one character. I use the➡
right arrow key for thisCtrl + b
- move cursor backward one character. I use the⬅
left arrow key for thisAlt + f
- move cursor forward one word. I useCtrl + ➡
for thisAlt + b
- move cursor backward one word. I useCtrl + ⬅
for thisCtrl + l
- clear the screen.clear
does the same thing
Cutting and pasting text
Ctrl + k
- cut text from the cursor location to the end of the lineCtrl + u
- cut text from the cursor location to the beginning of the lineAlt + d
- cut text from the cursor location to the end of the current wordAlt + Backspace
- cut text from the cursor location to the beginning of the current wordCtrl + y
- paste text into the current cursor location
Process Management
Ctrl + c
- to send a interrupt signal to the processCtrl + d
- exit the program indiscriminately
Other
!!
- entering this will rerun the last command. Can be used in conjunction withsudo
Ctrl + r
- reverse search. Will go through the last run commands in reverse order. Uses the bash history