Ten Keyboard Shortcuts To Up Your Terminal Game
Tags: productivity, terminal
Published: 2022-05-14 12:00:03

The terminal can be intimidating if you're not familiar with it. Typing in commands doesn't necessarily bring the same convenience as editing text in a word-processing software. Using your arrow keys to clear a mistyped word or backspacing to clear up your mistyped command can become very tedious very quickly. If you are looking for a way to make your terminal experience more enjoyable with keyboard shortcuts, you have just found the right article. 

This article will cover my 10 commonly used keyboard shortcuts for the terminal. I make use of the terminal on a macOS system with [Zsh](https://www.zsh.org/) combined with the [Oh My Zsh](https://ohmyz.sh/) framework. However, these keyboard shortcuts will also work with [Bash](https://www.gnu.org/software/bash/).

<hr />
### 1. TAB
![Autocomplete example with tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z63gdqr54vuo84v8eyj1.gif)
Don't know the exact directory name or are not in the mood to type that long file or directory name? Just type the first few characters and then hit the tab button to activate autocomplete!

### 2. Option + Left Arrow
![Example for moving back one word at a time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykv2z8arlex6dz9w1hj0.gif)
No need to press your arrow keys a couple of times to move the cursor per character. Wouldn't it be nice to move whole words to the left while saving some keystrokes?

### 3. Option + Right Arrow
![Example for moving forward one word at a time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7kv0y3bj6pys6615tzm.gif)
Moving forward by whole words should of course also be possible in the opposite direction. 

### 4. CTRL + A
![Example of moving to the beginning of the line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0nvwdx1ey04iv9tuiu13.gif)
What if after you've entered your whole command, you come to the conclusion that you forgot to add a particular word at the beginning of a line? That should be no problem at all, just a simple keystroke to move the cursor to the beginning of the line!

### 5. CTRL + E
![Example of moving to the end of the line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1a1eso1531mnkdbej9ig.gif)
It's also possible that you need to move to the end of the command to add something extra parameters. That's also possible without any trouble.

### 6. CTRL + W
![Example of deleting the previous word](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9igjgnv69wk7d531p49.gif)
No need to hit the backspace a couple of times to delete a word. Save yourself some time with this keyboard shortcut. 

### 7. CTRL + U
![Example of deleting a complete line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56gb7r13f331l6s52psr.gif)
Did you paste the wrong command into the terminal? Just delete the entire line with a simple keyboard shortcut!

### 8. CTRL + L
![Example of clearing the terminal output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uhinawagk7107vz7rego.gif)
Do you have a bunch of text output from one of your previous commands? Would you like to clear the whole terminal screen so you can start with a clean slate? You can type the clear command in your terminal to get the end result. That's 4 keystrokes. Who's got time for that? We can do it even more quickly with this keyboard shortcut! 

### 9. CTRL + D
![Example of closing the current terminal tab or window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mrkbjq5zqauddngphna.gif)
Do you have a bunch of tabs or windows open for your Terminal emulator? You can close them one by one by using this keyboard shortcut.

### 10. CTRL + C
![Example of stopping the current application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u1uwvccmy39wtfp5jsoh.gif)
Did you just start up an application with a command in the terminal? There is a very simple way to close this application and this may be one of the handiest keyboard shortcuts that can be used in many scenarios in which you are dealing with an unresponsive application.

<hr />

If the content was helpful, feel free to support me [here](https://www.buymeacoffee.com/duncanlew):
<a href="https://www.buymeacoffee.com/duncanlew" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>