Useful Linux Terminal Shortcuts

Ankit Shah
2 min readJul 27, 2023

--

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

--

--

Ankit Shah
Ankit Shah

Written by Ankit Shah

LLM Architecture Associate Director at Accenture.

No responses yet