CLI Shortcuts | Linux

2024/01/03
CLI Shortcuts | Linux

Mastering the Linux command line interface (CLI) can boost efficiency and flexibility. We will introduce a set of essential Linux CLI Shortcuts.

Essential Linux CLI Shortcuts:

  • Tab Auto-completion: Quickly complete commands, file paths, or directory names by pressing the Tab key.
  • Ctrl + C: Instantly stop a running process or command with this keyboard shortcut.
  • Ctrl + Z: Suspend a process, allowing it to be resumed or terminated later.
  • Ctrl + D: Signals the end of input, commonly used to close a terminal session.
  • Ctrl + R: Search through command history to easily find and re-run a specific command.
  • Ctrl + L: Clear the terminal screen, creating a cleaner workspace.
  • Ctrl + A: Move the cursor to the beginning of the line.
  • Ctrl + E: Move the cursor to the end of the line.
  • Ctrl + K: Delete everything after the cursor.
  • Ctrl + U: Delete the entire command line.
  • Ctrl + Y: Restore (paste back) text deleted by Ctrl+K or Ctrl+U.
    • Y stands for “yank” — before the clipboard existed in Windows, the command prompt era used “yank” for this operation.

Demo Commands:

# Tab auto-completion
ls /ho[TAB]user  # Auto-completes to ls /home/user

# Ctrl + C
ping example.com  # Press Ctrl + C to stop the ping process

# Ctrl + Z
nano  # Launch the nano text editor, then press Ctrl + Z to suspend it

# Ctrl + D
exit  # Use Ctrl + D to close the terminal session

# Ctrl + R
# Press Ctrl + R, start typing a command, then press Enter to execute the matched previous command

# Ctrl + L
# Clear the terminal screen for better visibility

Benefits of Linux CLI Shortcuts:

Using these shortcuts allows Linux CLI users to quickly navigate, manage processes, and optimize workflows, boosting their command line efficiency.

BenZ Software Developer

Software developer passionate about technology. Sharing programming experiences and learning notes.