Most developers spend hours every day in the terminal. Yet most developers also retype the same commands, renavigate the same directories, and fix the same typos over and over again. The difference between a fast terminal user and everyone else comes down to knowing the right shortcuts.
These aren't obscure tricks. They're battle-tested terminal shortcuts that work in Bash and Zsh out of the box. Learn them once, use them forever.
1. Jump to the Start or End of a Line
You mistyped something at the beginning of a long command. Instead of holding the left arrow for five seconds, use these:
# Jump to the beginning of the line
Ctrl + A
# Jump to the end of the line
Ctrl + E
This works in every readline-based shell. You'll use Ctrl + A constantly when you need to prepend sudo or change an environment variable at the start of a pipeline.
2. Delete an Entire Word (Not One Character at a Time)
Backspace is slow. When you need to erase a full argument or path segment, use word-level deletion:
# Delete the word before the cursor
Ctrl + W
# Delete from cursor to end of line
Ctrl + K
# Delete from cursor to start of line
Ctrl + U
Ctrl + W is the one you'll reach for most. Mistyped a flag? One keystroke removes it instead of hammering backspace eight times.
3. Search Your Command History Instantly
Scrolling through history with the up arrow is the slowest way to find a previous command. Reverse search gives you instant recall:
# Start reverse search
Ctrl + R
# Then type any fragment of the command you're looking for
(reverse-i-search)`deploy': git push origin main && vercel deploy --prod
Type a few characters and your shell searches backward through history for a match. Press Ctrl + R again to cycle through older matches. Press Enter to execute, or Ctrl + G to cancel.
This single shortcut replaces history | grep in 90% of cases.
4. Reuse the Last Argument from the Previous Command
You just created a directory. Now you want to cd into it. Instead of retyping the path:
mkdir -p src/components/dashboard/widgets
cd !$
# Expands to: cd src/components/dashboard/widgets
!$ grabs the last argument of the previous command. It also works with $_ in Bash, and you can use Alt + . (or Esc + .) to interactively cycle through last arguments from your history.
# Alt + . cycles through last arguments of recent commands
vim # then press Alt + . to insert the last argument of your previous command
This is particularly useful for sequences like touch, chmod, vim on the same file.
5. Fix Typos Without Retyping the Whole Command
You ran a command with a typo. Instead of pressing up, navigating to the typo, and fixing it, use caret substitution:
git stats
# bash: git: 'stats' is not a git command
^stats^status
# Runs: git status
The syntax is ^old^new. It replaces the first occurrence and reruns the command. For complex substitutions, use the full history expansion:
!!:s/staging/production/
# Reruns the last command, replacing 'staging' with 'production'
Tired of hunting for the right command? RewriteCmd turns plain English into precise shell commands. Describe what you want, get the exact command back -- no more man-page diving.
curl -fsSL https://rewritecmd.com/install | sh
6. Run Multiple Commands Intelligently
Chaining commands correctly saves you from watching failures cascade:
# Run second command ONLY if the first succeeds
npm run build && npm run deploy
# Run second command ONLY if the first fails
npm run build || echo "Build failed"
# Run both regardless of success/failure
npm run lint; npm run test
The && operator is the one to internalize. It prevents you from deploying broken builds or running migrations on a database that failed to connect.
7. Suspend and Resume Processes
You're editing a file in vim and need to run a quick shell command. Don't quit and reopen -- suspend it:
# Suspend the current foreground process
Ctrl + Z
# List suspended jobs
jobs
# Resume the most recently suspended job
fg
# Resume a specific job (from the jobs list)
fg %2
This is invaluable when you're bouncing between an editor and the shell. It's faster than opening a new tab because your editor state is preserved exactly where you left it.
8. Expand Braces for Repetitive Commands
Need to create multiple files or directories with similar names? Brace expansion eliminates the repetition:
# Create three files at once
touch src/{header,footer,sidebar}.tsx
# Create a full project structure in one command
mkdir -p project/{src/{components,utils,hooks},tests,docs}
# Rename a file (backup pattern)
cp config.json{,.backup}
# Expands to: cp config.json config.json.backup
The backup pattern (file{,.bak}) is worth memorizing on its own. One short command creates a safety copy before you edit anything.
9. Navigate Directories Without Typing Paths
cd is fine, but there are faster ways to move around:
# Go back to your previous directory
cd -
# Go to your home directory
cd ~
# Use pushd/popd as a directory stack
pushd /var/log # saves current dir, moves to /var/log
pushd /etc/nginx # saves /var/log, moves to /etc/nginx
popd # returns to /var/log
popd # returns to original directory
cd - is the unsung hero here. You're jumping between two directories constantly during development -- cd - makes it instant.
For more advanced directory navigation, tools like z, zoxide, or autojump learn your habits and let you jump to frequently used directories by typing a partial name: z proj takes you to ~/code/my-project.
10. Set Up Aliases for Commands You Run Daily
If you type a command more than twice a day, alias it:
# Add to your ~/.bashrc or ~/.zshrc
alias gs='git status'
alias gd='git diff'
alias gco='git checkout'
alias ll='ls -alF'
alias dc='docker compose'
alias k='kubectl'
alias tf='terraform'
# Reload your shell config
source ~/.zshrc
Good aliases share a few properties: they're short, mnemonic, and they save significant keystrokes on high-frequency commands. Don't alias everything -- only the commands you genuinely repeat.
For more complex automation -- like converting natural language into the right command or suggesting flags you didn't know existed -- tools like RewriteCmd go a step further. Instead of memorizing every flag for every tool, you describe what you want and get the exact command back. It's a natural complement to aliases: aliases handle the commands you already know, and RewriteCmd handles the ones you'd otherwise spend five minutes searching the man pages for.
About RewriteCmd
RewriteCmd is a command-line productivity tool that translates natural language into shell commands. Instead of memorizing flags, reading man pages, or searching Stack Overflow, you describe what you want in plain English and RewriteCmd gives you the precise command. It works alongside your existing shell setup -- your aliases, your shortcuts, your muscle memory -- and fills in the gaps for everything you don't use often enough to remember.
Install it in seconds:
curl -fsSL https://rewritecmd.com/install | sh
Bonus: The Shortcuts Cheat Sheet
Here's a quick reference you can pin:
| Shortcut | Action |
|---|---|
Ctrl + A | Jump to start of line |
Ctrl + E | Jump to end of line |
Ctrl + W | Delete previous word |
Ctrl + K | Delete to end of line |
Ctrl + U | Delete to start of line |
Ctrl + R | Reverse history search |
Ctrl + Z | Suspend process |
Ctrl + L | Clear screen |
Alt + . | Insert last argument |
!! | Repeat last command |
!$ | Last argument of previous command |
cd - | Previous directory |
Start Using Them Today
You don't need to memorize all ten at once. Pick the two or three that match your workflow and force yourself to use them for a week. Ctrl + R and Ctrl + W alone will change how fast you work.
The terminal rewards muscle memory. Every shortcut you internalize is a few seconds saved per use, hundreds of times a day. That compounds into real hours every week -- time you can spend building instead of navigating.
And when you hit a command you can't remember? RewriteCmd has your back. Describe it, get the command, keep moving.
curl -fsSL https://rewritecmd.com/install | sh