Learning the keyboard shortcuts for your development tools is essential if you want to be a productive developer.
These are a few of my favourites for the Mac OS Terminal.
Navigation
Have you ever made a single character typo in a complex command, then had to hold the left arrow key down for what seems like an age to get to the right spot to fix your mistake? No longer! Discover how much faster you can traverse the command line by moving the cursor by word instead of by character :)
Move to the beginning of the line:
Ctrl + aMove to the end of the line:
Ctrl + eMove forward a word:
Alt + fMove backward a word:
Alt + bClear the screen:
Ctrl + lClear the line:
Ctrl + uClear the line after the cursor:
Ctrl + kClear the line before the cursor:
Ctrl + wPaste the last command:
Ctrl + yStack management
Do you need to jump between a few different file locations, with really long paths, possibly on different servers? Use these shortcuts to add paths to a stack, so you don't have to cd: /super/long/file/path back and forth.
Add a directory to the stack:
pushd /path/to/dirNavigate to the most recent directory in the stack:
popdList the directories in the stack:
dirsClear the stack:
dirs -cSwitch to the previous directory:
cd -History
Typed in a complex command but can't remember the arguments you passed to it the first time around? Grab it from your command history!
Show the last command:
!!Show the history:
historyShow the last 10 commands:
history 10Show the last 10 commands with line numbers:
history 10 | nlSearch through previous commands (this one is *chef's kiss*):
ctrl + r
(type in search term)
ctrl + r to cycle through results
enter to execute command
q to quit search