Useful Linux Terminal Shortcuts
2 min readJul 27, 2023
- Tab Completion: Pressing
Tab
will attempt to auto-complete the command or file/directory name you're typing. If multiple completions are possible, pressingTab
twice will list them. - Arrow Keys: Use the up and down arrow keys to cycle through previously entered commands.
- Ctrl + R: Search through your command history. As you start typing, it will autocomplete with previously used commands.
- Ctrl + C: Cancel the current command or process.
- Ctrl + D: Log out of the current terminal session. Also used to signal end of input in many command line programs.
- Ctrl + Z: Suspend the current process by sending the SIGSTOP signal. You can later use
fg
to continue the process. - Ctrl + L: Clear the terminal screen, similar to typing the
clear
command. - Ctrl + A: Move the cursor to the beginning of the line.
- Ctrl + E: Move the cursor to the end of the line.
- Ctrl + K: Cut (delete) everything after the cursor to the clipboard.
- Ctrl + U: Cut everything before the cursor to the clipboard.
- Ctrl + Y: Paste the last thing you cut from the clipboard.
- Ctrl + W: Cut the word before the cursor.
- Alt + B: Move back one word at a time.
- Alt + F: Move forward one word at a time.
- !!: Execute the last command.
- !$: Use the last argument of the previous command.
- !command: Execute the last command that starts with ‘command’.
- !number: Execute the command with the given number from history.
- Command
>
filename: Redirect the output of a command to a file, overwriting the current content of the file. - Command
>>
filename: Redirect the output of a command to a file, appending to the current content of the file. - Command1
|
Command2: Pipe the output of Command1 to the input of Command2.