Linux Terminal Hotkeys
Linux terminal hotkeys (keyboard shortcuts) can significantly enhance productivity by letting you perform common actions quickly without relying on the mouse. This article covers essential terminal shortcuts, what they do, and how they can improve your command-line workflow.
1. Basic Terminal Hotkeys
1.1. Navigation Shortcuts
- Ctrl + A: Move the cursor to the beginning of the line.
- Ctrl + E: Move the cursor to the end of the line.
- Ctrl + U: Cut text from the cursor to the beginning of the line.
- Ctrl + K: Cut text from the cursor to the end of the line.
- Ctrl + W: Cut the word before the cursor.
1.2. Command History
- Up Arrow: Scroll up through command history.
- Down Arrow: Scroll down through command history.
- Ctrl + R: Search through command history (start typing to find a match).
- Ctrl + G: Exit history search mode.
2. Text Manipulation Hotkeys
2.1. Editing Text
- Ctrl + C: Cancel the current command or terminate the current process.
- Ctrl + Z: Suspend the current process (resume it with).
fg - Ctrl + D: Send EOF (End Of File). This may log you out of the session or close the terminal when no input is active.
2.2. Word and Line Manipulation
- Alt + B: Move the cursor backward one word.
- Alt + F: Move the cursor forward one word.
- Ctrl + Y: Paste (yank) the last cut text.
- Ctrl + X, then Ctrl + E: Open the current command in the default text editor for editing.
3. Process Management Hotkeys
- Ctrl + C: Terminate the running process in the terminal.
- Ctrl + Z: Suspend a running process and return to the shell (resume with).
fg - Ctrl + D: Send EOF, which can terminate some processes that read from standard input.
4. Terminal Control Hotkeys
- Ctrl + L: Clear the terminal screen (same as running).
clear - Ctrl + S: Pause terminal output (resume with Ctrl + Q).
- Ctrl + Q: Resume output after Ctrl + S.
5. Advanced Command Line Hotkeys
5.1. Running Previous Commands
- : Run the previous command again.
!! - : Run the nth command in your history (replace
!nwith the command number).n - : Run the most recent command that begins with
!string.string
5.2. Permissions and Terminal Launch
- : Execute a command with superuser (root) privileges.
sudo - Ctrl + Alt + T: Open a new terminal window (commonly supported in many Linux desktop environments).
6. Customizing Keyboard Shortcuts
Many Linux distributions allow you to customize keyboard shortcuts for terminal applications. These options are usually available in system settings under a Keyboard section.
Conclusion
Mastering Linux terminal hotkeys can significantly improve efficiency when working in the command line. By practicing and incorporating these shortcuts into your daily workflow, you can navigate faster, edit input more effectively, and manage processes with less friction.
