Linux Terminal Shortcuts

You can not enjoy the full range of control and benefits, Linux operating system has to offer without the Command-Line interface or terminal. But the terminal is manual and can be difficult to use, especially if you have transitioned from another operating system.

In this article, you will learn terminal shortcuts that are convenient and will boost your work efficiency in the terminal by leaps and bounds.

Note: All the commands in this article are written in capital for formatting sake so you do not need press shift while executing them. For example, Ctrl+C is equivalent to ctrl+c.

Prerequisites

  • Linux-based system
  • Terminal access

Note: The commands in this tutorial are executed on the Ubuntu 20.04 system. All the methods in the tutorial are valid for any Linux-based system.

Recall/Autocomplete Past Commands in the Terminal With Tab

If you only remember a partial command or want to autocomplete your command, press the tab button to see the available options.

Terminal auto complete

Navigate Through Past Commands in the Terminal With Ctrl+P and Ctrl+N

You can Press Ctrl+P to see the previously run command in the terminal. Similarly, You can backtrack and Press Ctrl+N to see the next run command. Please note that in some Linux systems, you can do the same with the arrow key buttons.

Clear the Terminal With Ctrl+L

If you have been using the clear command every time to clear your terminal window, Now press Ctrl+L when you need a clear window.

Logout/Exit the Terminal With Ctrl+D

Press Ctrl+D to log out or close the terminal. But keep in mind if you have any process still in the background, You will need to use this shortcut twice, as shown in the output here.

Exit the terminal

Navigate the Cursor With Ctrl+A and Ctrl+E

Currently, you have to use arrows to move the cursor, which is frustrating. But now, you can move your cursor with a simple shortcut.

Press Ctrl+A to move the cursor directly to the front of the line.

Cursor navigation

Similarly, You can press Ctrl+E to jump the cursor to the end of the line/command.

Go to the end of the line

Edit the Commands Effectively With Terminal Shortcuts

Using backspace in the terminal is the bane of existence for every Linux user. Following are some shortcuts that can help with this problem.

Remove Commands With Ctrl+U and Ctrl+K

You can press Ctrl+U to remove everything from the beginning to the cursor point. While if you want to remove anything that comes after the cursor point, you have to use the Ctrl+K shortcut.

Remove commands

Note the cursor point and see the outputs beneath to clarify the difference between these two shortcuts.

ctrl + u

ctrl + k

Remove Words From Commands With Ctrl+W

Sometimes you want to remove only certain words from the command. If that is the case, move your cursor to the end of the word that you want to remove and press Ctrl+W.

Remove Words From Commands

ctrl + w

Reset/Paste the Removed Commands With Ctrl+Y

If you have used any of the above shortcuts to remove Part of the command. You can reverse the change by pressing Ctrl+Y.

Stop/Disrupt Running Processes in Terminal with Ctrl+C and Ctrl+Z

If you want any command to stop running, simply press Ctrl+C while the command is executing. The terminal will end that process right away.

kill processes

In case you need to pause or send any process to the background, press Ctrl+Z.

ctrl + z

Search through Your Terminal History With Ctrl+R

You can see your terminal command history with the following command. It is very useful if you forget any command or want to see the option used in the command.

history

History command

You can use the Ctrl+R shortcut to search the history instead of going through the command records manually.

ctrl + r shortcut

Conclusion

It does not matter if you are a beginner or a veteran in the Linux terminal, you all can incorporate the shortcuts discussed in this article when you are working with the terminal. It will benefit you in terms of time and effort. These simple shortcuts can make a major difference in your ease with the terminal in the long run.

Leave a Comment