In this article, we have compiled the most useful Linux terminal hotkeys that may come in handy for you. There are key combinations for navigating command history, error correction, and controlling the terminal window. All keys are arranged in random order.
The content of the article:
LINUX TERMINAL HOTKEYS
It is impossible to use the terminal without this combination, and therefore everyone knows it. A single press of the Tab key automatically completes the current command or file path if only one option is possible. Two clicks in a row show possible options for auto-completion. This makes the set of commands and file paths much faster.
2. CTRL + R
After pressing Ctrl + R , a search bar appears in which you can begin to enter the name of the command to be executed. The system will find all the commands that were previously executed with this beginning and display the latest. You can refine your search by adding a few more characters. To execute the command, just press Enter , to edit Esc .
3. CTRL + C
This key combination allows you to interrupt the work of any program that runs in the terminal. After pressing Ctr + C, a SIGINT signal is sent to the program and if it does not process it in a special way, the program ends. Some programs intercept the signal and perform some actions to save data and complete operations before completion, for example, the zypper batch manager.
4. CTRL + Z
Using Ctrl + Z you can put the current program in the background. Usually, if you want the program to run in the background, just add the & symbol after the command. But if you forgot to do this, this key combination will help. To see the tasks that are currently working in the background, use the jobs command , and to return the task to normal mode, use the fg command .
5. CTRL + D
The keyboard shortcut Ctrl + D can be considered an alternative to the exit command . If you are connected via SSH then the session will be broken. If you work directly in the terminal, the window will be closed.
6. CTRL + L
An alternative to the clear command. Allows you to clear the terminal output. It is very convenient for creating screenshots and just for clearing unnecessary information.
7. CTRL + P AND CTRL + N
These keyboard shortcuts are alternatives to the up and down arrow keys. The first shows the previous command entered, and the second the next. So you can navigate through the history of teams. This is not more convenient than a shooter, but sometimes it can be useful.
8. CTRL + A AND CTRL + E
You can navigate not only by the history of teams, but also by the current line. These hotkeys are analogues of the Home and End keys . The first combination moves the cursor to the beginning of the system, and the second to the end.
9. Ctrl + U and Ctrl + K
Using the first combination, you can delete all text from the beginning of the line to the cursor position, and using the second one, from the cursor position to the end of the line. This can be useful if you entered the wrong command and do not want to erase it one character at a time.
10. CTRL + W
By pressing Ctrl + W you can erase the word in front of the cursor. If the cursor is in the middle of the word, then all characters from the cursor to the beginning of the word will be erased. It is most convenient to place the cursor after the word to be removed.
11. CTRL + Y
Use the Ctrl + Y , you can paste the text cut using Ctrl + U, Ctrl + K , and the Ctrl + the W . The text will be inserted where the cursor is.
12. CTRL + B AND CTRL + F
An analogue for the right arrow and left arrow keys. The first combination allows you to move one character to the right, and the second one character to the left.
13. CTRL + T
Replaces the character under the cursor with the previous character. Or moves the character before the cursor to the end of the line.
14. CTRL + X THEN CTRL + E
Opens the current command in a text editor. If no editor is specified in the EDITOR variable, nano will be used. After editing and saving the result, the command will be executed. Convenient for writing multi-line scripts.
15. ALT +.
An analogue of the command $ !. Allows you to insert the last argument of the previous command at the cursor position. It is convenient if you need to execute several commands with the same argument.
16. ALT + B AND ALT + F
These combinations allow you to navigate through the words, as well as their counterparts with Ctrl by character. Alt + B moves the cursor one word to the left, and Alt + F one word to the right.
17. ALT + C, ALT + L AND ALT + U
The following three keyboard shortcuts let you play with the character case of a command. The first combination - Alt + C makes the character under the cursor uppercase, and all other letters to the end of the word are lowercase. Alt + L makes all letters to the end of the word lowercase, and Alt + U - uppercase.
18. CTRL + S AND CTRL + Q
If the command displays information too quickly, and you need to read it or copy it, you can ask the terminal to pause the output of the command. To do this, press the Ctrl + the S . To return everything back, press the Ctrl + the Q .
TERMINAL EMULATOR KEYBOARD SHORTCUTS
All the keyboard shortcuts listed above will work in all terminals and terminal emulators that use the Bash command shell or another popular shell. But popular terminal emulators have their own hot keys, which can be very useful for you when working. Let's look at them too. Gnome Terminal hotkeys will be used in this article, but they are similar in other terminals.
1. CTRL + ALT + T
Using this keyboard shortcut, you can open a terminal on most distributions based on Ubuntu and Debian. It's easy, fast and convenient.
2. CTRL + SHIFT + C AND CTRL + SHIFT + V
Copy and paste are very important features of the operating system. The keyboard shortcut Ctrl + C simply cannot work for copying, because it is used to complete the command, so the Shift key was added to copy and paste.
3. CTRL + SHIFT + F
If you need to search the output in the terminal, you can use a combination of the Ctrl + the Shift + the F . After clicking, an input window will open in which you can enter the search word.
4. SHIFT + LMB AND SHIFT + RMB
Here LMB and RMB are the right and left mouse buttons. Programs such as screen and tmux in the mouse support mode take control of the mouse and knit their functions on it. Thus, normal copying and pasting can be a problem. To avoid this, you can select text with the keyboard shortcut Shift + LMB and open the context menu using Shift + RMB.