12 Command Line Keyboard Shortcuts for Mac OS X Terminal
The command line in Mac OS X can be a very powerful and fun tool, so it’s good to know how to maneuver around if you find yourself in it. By default, the Mac OS X Terminal uses the Bash shell, which is what these keyboard shortcuts are intended for.
So if you’re ready to get your feet wet, open up the Terminal and try these shortcuts out, they’re sure to make your command line life easier.
While the keystrokes will perform some incredibly useful tasks, the complexity isn’t too deep or crazy so you should be able to try all these out within a minute or two. Take a moment to do that, learn a bit more about the command line, and have fun.
12 Command Line Keyboard Shortcuts for Mac OS X
These will work in the Mac Terminal for any version of Mac OS X, that includes the default Terminal app and third party terminal applications like iTerm as well. Technically, these should work in Linux and other Bash shells too, but obviously we’re focusing on the Mac here.
|Ctrl + A||Go to the beginning of the line you are currently typing on|
|Ctrl + E||Go to the end of the line you are currently typing on|
|Ctrl + L||Clears the Screen, similar to the clear command|
|Ctrl + U||Clears the line before the cursor position. If you are at the end of the line, clears the entire line.|
|Ctrl + H||Same as backspace|
|Ctrl + R||Let’s you search through previously used commands|
|Ctrl + C||Kill whatever you are running|
|Ctrl + D||Exit the current shell|
|Ctrl + Z||Puts whatever you are running into a suspended background process. fg restores it.|
|Ctrl + W||Delete the word before the cursor|
|Ctrl + K||Clear the line after the cursor|
|Ctrl + T||Swap the last two characters before the cursor|
|Esc + T||Swap the last two words before the cursor|
If you have any other handy keyboard shortcuts or tricks for the command line, share them with us!