- 13 Linux Terminal Shortcuts Every Power Linux User Must Know
- Must Know Linux Shortcuts
- 1. Tab
- 2. Ctrl + C
- 3. Ctrl + Z
- 4. Ctrl + D
- 5. Ctrl + L
- 6. Ctrl + A
- 7. Ctrl + E
- 8. Ctrl + U
- 9. Ctrl + K
- 10. Ctrl + W
- 11. Ctrl + Y
- 12. Ctrl + P
- 13. Ctrl + N
- Bonus shortcut: Ctrl + R to search in command history
- Download FREE terminal shortcut cheatsheet
- Useful Linux Terminal Keyboard Shortcuts Cheat Sheet
- Linux Terminal Command Editing Shortcuts
- Linux Terminal Command Control Shortcuts
- Linux Command Recall Shortcuts
- Linux Bash Bang (!) Commands Shortcuts
- 5 ways to navigate the Linux terminal faster
- Great Linux resources
- 1. Navigate without the arrow keys
- 2. Don’t use the backspace or delete keys
13 Linux Terminal Shortcuts Every Power Linux User Must Know
Use Linux command line like a pro by mastering these Linux terminal shortcuts and increase your productivity. It’s a must for any power Linux user.
You know what sets apart a pro user from a regular user? Mastery over the keyboard shortcuts.
Alright! That’s not the only thing but it is undoubtedly a factor.
Shortcuts help you to be more productive and efficient with whatever tool you use. Just think about it. If someone holds the mouse all the way down to copy entire text instead of Ctrl+A, how would you feel about it?
Linux terminal is not an exception. There are certain Linux terminal shortcuts that every user must know and practice.
Trust me; once you master these shortcuts, you’ll notice how good you are with using the Linux command line.
Must Know Linux Shortcuts
I would like to mention that some of these shortcuts may depend upon the Shell you are using. Bash is the most popular shell, so the list is focused on Bash. If you want, you may call it Bash shortcut list as well.
Do note that I have used the capital letters in the keyboard shortcuts but this does NOT mean that you have to press the shift key while using these shortcuts.
1. Tab
This is the Linux shortcut you cannot live without. It will save you so much time in the Linux command line.
Just start typing a command, filename, directory name or even command options and hit the tab key. It will either automatically complete what you were typing or it will show all the possible results for you.
If you could only remember one shortcut, this would be the chosen one.
2. Ctrl + C
These are the keys you should press in order to break out of a command or process on a terminal. This will stop (terminate) a running program immediately.
If you want to stop using a program running in the foreground, just press this key combination.
3. Ctrl + Z
This shortcut will suspend a running program and gives you control of the shell. You can see the stopped program in background jobs and even resume to run it using the fg command.
4. Ctrl + D
This keyboard shortcut will log you out of the current terminal. If you are using an SSH connection, it will be closed. If you are using a terminal directly, the application will be closed immediately.
Consider it equivalent to the ‘exit’ command.
5. Ctrl + L
How do you clear your terminal screen? I guess using the clear command.
Instead of writing C-L-E-A-R, you can simply use Ctrl+L to clear the terminal. Handy, isn’t it?
6. Ctrl + A
This shortcut will move the cursor to the beginning of the line.
Suppose you typed a long command or path in the terminal and you want to go to the beginning of it, using the arrow key to move the cursor will take plenty of time. Do note that you cannot use the mouse to move the cursor to the beginning of the line.
This is where Ctrl+A saves the day.
7. Ctrl + E
This shortcut is sort of opposite to Ctrl+A. Ctrl+A sends the cursor to the beginning of the line whereas Ctrl+E moves the cursor to the end of the line.
Note: If you have the Home and End keys on your keyboard, you can also use them. Home is equivalent to Ctrl +A and End is equivalent to Ctrl + E.
8. Ctrl + U
Typed a wrong command? Instead of using the backspace to discard the current command, use Ctrl+U shortcut in the Linux terminal. This shortcut erases everything from the current cursor position to the beginning of the line.
9. Ctrl + K
This one is similar to the Ctrl+U shortcut. The only difference is that instead of the beginning of the line, it erases everything from the current cursor position to the end of the line.
10. Ctrl + W
You just learned about erasing text till the beginning and the end of the line. But what if you just need to delete a single word? Use the Ctrl+W shortcut.
Using Ctrl+W shortcut, you can erase the word preceding to the cursor position. If the cursor is on a word itself, it will erase all letters from the cursor position to the beginning of the word.
The best way to use it to move the cursor to the next space after the targetted word and then use the Ctrl+W keyboard shortcut.
11. Ctrl + Y
This will paste the erased text that you saw with Ctrl + W, Ctrl + U and Ctrl + K shortcuts. Comes handy in case you erased wrong text or if you need to use the erased text someplace else.
12. Ctrl + P
You can use this shortcut to view the previous command. You can press it repeatedly to keep on going back in the command history. In a lot of terminals, the same can be achieved with PgUp key.
13. Ctrl + N
You can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the next command. If you are viewing previous commands with Ctrl+P, you can use Ctrl+N to navigate back and forth. Many terminals have this shortcut mapped to the PgDn key.
Bonus shortcut: Ctrl + R to search in command history
You typed some command but cannot remember what it was exactly? Meet Ctrl + R.
This keyboard shortcut allows you to perform a search in your command history. Just press Ctrl+R and start typing. It will show the last command that matches the string you typed. Note that the typed string could be anywhere in the command. How cool is that?
If you want to see more commands for the same string, just keep pressing Ctrl + R.
You can press enter to run the command selected or press Esc to come out of the search with the last search result.
Download FREE terminal shortcut cheatsheet
The best way to learn new keyboard shortcuts is by keeping a cheat sheet pinned to your disk. You cannot possibly remember the new shortcuts so having the shortcuts in front of you gives the ability to look at it at a quick glance. This way you’ll use them more often and eventually, it gets added to your muscle memory.
To help you with that, I have added a one-page PDF. You can print it and keep it at your desk.
Useful Linux Terminal Keyboard Shortcuts Cheat Sheet
While working on the Linux command-line environment, there is more to using this OS interface than just keying in and executing various Linux commands with respect to the computing objective you wish to accomplish.
There are a variety of Linux command line keyboard shortcuts that will help you as a user in mastering command editing, command control, command recall, and other helpful command tweaks.
This article guide will walk us through some of these Linux command line keyboard shortcuts which should hopefully lessen the complexities around the usage of the Linux terminal environment.
Linux Terminal Command Editing Shortcuts
Command | Usage |
---|---|
Ctrl + a | This keyboard shortcut takes the blinking cursor to the beginning of a command. |
Ctrl + e | This keyboard shortcut takes the blinking cursor to the end of a command. |
Ctrl + k | Deletes everything between the cursor position and the end of the command. |
Ctrl + u | Deletes everything between the cursor position and the start of a command. |
Ctrl + w | Backward deletes one word from the cursor position. |
Ctrl + y | Pastes cut word/text (by deletion shortcut like Ctrl+w) in front of the cursor. |
Ctrl + xx | Enables navigation between the start of a command and the current cursor position. |
Alt + b | Navigate backward word by word from the current cursor position. |
Alt + f | Navigate forward word by word from the current cursor position. |
Alt + d | From the cursor position, delete to the end of the word. |
Alt + u | Make uppercase from the cursor position to the end of the word. |
Alt + l | Make lowercase from the cursor position to the end of the word/text. |
Alt + t | Swap previous with current word. |
Ctrl + f | Move a character forward from the cursor position. |
Ctrl + b | Move a character backward from the cursor position. |
Ctrl + d | Delete the character highlighted by the cursor. |
Ctrl + h | Delete the character behind the cursor. |
Ctrl + t | swap the character under the cursor with the previous one. |
Linux Terminal Command Control Shortcuts
Command | Usage |
---|---|
Ctrl + l | Clear the terminal screen of all commands. |
Ctrl + s | Prevents printing output to the screen when running verbose commands. |
Ctrl + q | Re-allows output to the terminal screen previously stopped by Ctrl + s. |
Ctrl + c | Terminates a command’s execution. |
Ctrl + z | Stops or suspends a command. |
Linux Command Recall Shortcuts
Command | Usage |
---|---|
Ctrl + r | Search command history backward. |
Ctrl + g | Escape from history searching mode. |
Ctrl + p | Prints previous command from the command history. |
Ctrl + n | Walk you through printed command history commands. |
Alt + . | Adopts the previous command’s last word. |
Linux Bash Bang (!) Commands Shortcuts
Command | Usage |
---|---|
!! | Executes the most recently executed command. |
!ping | Executes a recently executed command starting with the word ping. |
!ping:p | Prints previously executed command associated with ping and make it the latest addition in the command history. |
!$ | Prints the previously executed command’s last word. |
!$:p | Prints out the substitute word for !$. |
!* | Prints out previously executed command with exception to its last word associate. |
!*:p | Prints a possible substitute for !*. |
With this Linux Command Line keyboard shortcuts cheat sheet, you should be able to attain more productivity in the Linux terminal environment.
5 ways to navigate the Linux terminal faster
Shortcut keys provide an easier and quicker method of navigating and executing commands on the command line.
One of the advantages of working in a terminal is that it’s faster than most other interfaces. Thanks to the GNU Readline library and the built-in syntax of shells like Bash and Zsh, there are several ways to make your interactions with the command line even faster. Here are five ways to make the most of your time in the terminal.
Great Linux resources
1. Navigate without the arrow keys
While executing commands on the command line, sometimes you miss a part at the beginning or forget to add certain tags or arguments toward the end. It’s common for users to use the Left and Right arrow keys on the keyboard to move through a command to make edits.
There’s a better way to get around the command line. You can move the cursor to the beginning of the line with CTRL+A. Similarly, use CTRL+E to move the cursor to the end of the line. Alt+F moves one word forward, and Alt+B moves one word back.
- Instead of Left arrow, left, left, left, use CTRL+A to go to the start of the line or Alt+B to move back one word.
- Instead of Right arrow, right, right, right, use CTRL+E to move to the end of the line, or Alt+F to move forward a word.
2. Don’t use the backspace or delete keys
It’s not uncommon to misspell commands. You might be used to using the Backspace key on the keyboard to delete characters in the backward direction and the Delete button to delete them in the forward direction. You can also do this task more efficiently and easily with some helpful keyboard shortcuts.
[ Want to test your sysadmin skills? Take a skills assessment today. ]
Instead of deleting commands character by character, you can delete everything from the current cursor position to the beginning of the line or the end.
Use CTRL+U to erase everything from the current cursor position to the beginning of the line. Similarly, CTRL+K erases everything from the current cursor position to the end of the line.