20 Terminal shortcuts developers need to know

These days, more and more developers are moving to OS X. Here are 20 shortcuts to help you get work done in Terminal on your Mac.

Boasting some of the best web development software, the ability to develop for almost any platform, and a great design and user experience, it's no wonder why Macs are used by many developers as their primary machine.

As a developer, being able to properly navigate your keyboard is one of the most useful skills you can have. Also, Macs are known for having their own proprietary set of keys that differ from more traditional keyboards.

Whether you're a recent convert from Windows or Linux, or you're about to start your first job out of school, here are 20 keyboard shortcuts on OS X that will make life easier if you're working in Terminal.

Option/Alt + Left or Right

This shortcut allows you to move the cursor between separate words in a command line. Use Option and the left arrow to move back and use Option with the right arrow to move forward down the line.

Control + W

Using this keyboard combination will delete the word immediately before, or to the left of, the cursor.

Escape + T

This will swap the two words that appear immediately before the cursor. So, if "this is" sits before the cursor, using Escape and T will change that to "is this."

Control + R

If you need to locate a previously used command in Terminal, use Control and R. It will open up [(reverse-i-search)`':] and allow you to find a previously used commands that you may need to access again.

Command + A

Using Command and A will take you to the end, or the far right, of the line where your cursor is.

Command +E

This shortcut is the opposite of Command and A. Command and E will take you back to the beginning, or the far left, of the line you are currently working on.

Control + C

If you need to kill what's currently running, us Control and C in Terminal to abort the current application.

Control + U

This shortcut clears the entirety of the line before the cursor. So, if you get to the end of a line and realize the whole thing is wrong, use Control and U to delete it all.

Control + K

Using Control and K will have the opposite effect as using Control and U. This will clear the line that appears after the cursor. It is helpful if you need to change or delete the latter half of a line.

Command + K

This will clear the entire Terminal screen you're working on, deleting everything. The same thing can be accomplished using Control and L or by typing "clear" into Terminal.

Control + D

This will cause you to exit the current shell in Terminal.

Control + Z

Suspends what you are currently running in the background.


This executes the last command entered. If you run into permission issues, try entering sudo before !!.

Control + H

Essentially the same thing as backspace, but it is useful if you want to stay anchored on the home row keys.


Typing "top" into Terminal will display all of your active processes. Similar to what you'd get from Activity Monitor, but within Terminal. Press "Q" to quit.

History + a number

If you've lost track of a command you typed earlier, you can type "history" into Terminal to retrieve a history of your commands. However, if you want to view a specific number of past commands simply type a space then a number after history. So, "history 5" would show you the last five commands you typed.

Control + F

This shortcut moves the cursor forward to the next character on the line. It is essentially the same thing as using the right arrow key, but keeps you on the home row keys.

Control + B

This shortcut moves the cursor back to the previous character on the line. It gives you the same result as using the left arrow key, but keeps you on the home row keys.

Escape + F

Using this combination will move your cursor to the next word on the line, similar to Option and right arrow that was mentioned earlier.

Escape + B

This is an alternate way of moving the cursor back by one word, like you would do using the Option and left arrow shortcut. However, this keeps your fingers better positioned on the keyboard.

Also see

About Conner Forrest

Conner Forrest is News Editor for TechRepublic. He covers enterprise technology and is interested in the convergence of tech and culture.

Editor's Picks