Ten Keyboard Shortcuts To Up Your Terminal Game

Duncan Lew
4 min readMay 14, 2022

--

Terminal output

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 combined with the Oh My Zsh framework. However, these keyboard shortcuts will also work with Bash.

1. TAB

Autocomplete example with tab

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

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

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

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

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

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

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

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

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

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.

If the content was helpful, feel free to support me here:

Buy me a coffee link for Duncan Lew

--

--