🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

5 Linux Terminal Shortcuts That Will Double Your Productivity

5 Linux Terminal Shortcuts That Will Double Your Productivity

Small efficiency gains add up to hours saved over time. These five terminal shortcuts and techniques are used daily by experienced Linux administrators and developers. Learn them once and benefit forever.

1. Reverse History Search (Ctrl+R)

Stop retyping long commands. Press Ctrl+R and start typing any part of a previous command:

# Press Ctrl+R, then type "docker"
(reverse-i-search)`docker': docker compose -f production.yml up -d

# Press Ctrl+R again to cycle through older matches
# Press Enter to execute, or Ctrl+C to cancel
# Press Right arrow to edit the command before executing

2. Command Substitution and Chaining

# Run command only if previous succeeds (&&)
sudo apt update && sudo apt upgrade -y

# Run command regardless of previous result (;)
make clean; make build; make test

# Run command only if previous fails (||)
ping -c 1 server.com || echo "Server is down!"

# Use output of one command in another
vim $(find . -name "config.yml")
kill $(pgrep -f "python app.py")

3. Powerful Aliases and Functions

Add these to your ~/.bashrc or ~/.zshrc:

# Quick navigation
alias ..="cd .."
alias ...="cd ../.."
alias ll="ls -alFh"
alias la="ls -A"

# Safety nets
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"

# Quick server check
alias ports="sudo ss -tulnp"
alias myip="curl -s ifconfig.me"

# Git shortcuts
alias gs="git status"
alias gc="git commit -m"
alias gp="git push"
alias gl="git log --oneline -20"

# Functions for common tasks
mkcd() { mkdir -p "$1" && cd "$1"; }
extract() {
    case "$1" in
        *.tar.gz) tar xzf "$1" ;;
        *.tar.bz2) tar xjf "$1" ;;
        *.zip) unzip "$1" ;;
        *.gz) gunzip "$1" ;;
        *) echo "Unknown format" ;;
    esac
}

4. Clipboard Integration

# Copy command output to clipboard
cat ~/.ssh/id_rsa.pub | xclip -selection clipboard

# Copy file contents
xclip -selection clipboard < file.txt

# Paste from clipboard into command
xclip -selection clipboard -o | grep "pattern"

# On macOS: use pbcopy and pbpaste instead

5. Bang Commands for History Reuse

# Repeat last command
!!

# Run last command with sudo
sudo !!

# Repeat last command starting with specific string
!docker
!ssh

# Use last argument of previous command
mkdir /var/www/newsite
cd !$
# cd /var/www/newsite

# Use all arguments of previous command
echo one two three
printf "%s\n" !*

Bonus: Essential Keyboard Shortcuts

  • Ctrl+A — Move cursor to beginning of line
  • Ctrl+E — Move cursor to end of line
  • Ctrl+W — Delete word before cursor
  • Ctrl+U — Delete from cursor to beginning of line
  • Ctrl+K — Delete from cursor to end of line
  • Ctrl+L — Clear screen (same as clear)
  • Ctrl+Z — Suspend current process (resume with fg)

Practice one shortcut at a time until it becomes muscle memory. Within a week, you will notice a significant improvement in your command-line speed.

Share this article:
Nico Brandt
About the Author

Nico Brandt

JavaScript Development, TypeScript Engineering, Web Application Architecture, Technical Documentation

Nico Brandt is a JavaScript and TypeScript developer focused on building well-structured, maintainable, and scalable web applications.

He works extensively with modern JavaScript and TypeScript across frontend and backend environments, emphasizing type safety, code readability, and predictable application behavior.

...
JavaScript TypeScript Frontend Development Backend APIs Asynchronous Programming

Stay Updated

Subscribe to our newsletter for the latest tutorials, tips, and exclusive offers.