Back to Blog
Developer ToolsProductivityTerminalShortcuts

Terminal Shortcuts Every Developer Should Master (Bash, Zsh, and Beyond)

Published on April 4, 20268 min read

Terminal Shortcuts Every Developer Should Master

The terminal is where developers live. Whether you are running builds, managing servers, navigating files, or debugging -- you are typing commands hundreds of times a day. Yet most developers only know how to type, backspace, and press Enter.

The terminal has an incredibly rich set of keyboard shortcuts inherited from decades of Unix history. Learning them does not just save time -- it changes your relationship with the command line from "tool I have to use" to "tool I think through."


Line Editing: Stop Pressing Backspace 40 Times

These shortcuts work in Bash, Zsh, and most terminal emulators. They use Emacs-style keybindings, which are the default.

Moving the Cursor

  • Ctrl + A -- jump to the beginning of the line
  • Ctrl + E -- jump to the end of the line
  • Alt + F -- move forward one word
  • Alt + B -- move backward one word
  • Ctrl + F -- move forward one character (same as right arrow)
  • Ctrl + B -- move backward one character (same as left arrow)

The word-jumping shortcuts (Alt+F, Alt+B) are the most important. When your cursor is at the end of a long command and you need to change a flag in the middle, jumping word by word is dramatically faster than holding the left arrow.

Deleting Text

  • Ctrl + U -- delete everything before the cursor (to the beginning of the line)
  • Ctrl + K -- delete everything after the cursor (to the end of the line)
  • Ctrl + W -- delete the word before the cursor
  • Alt + D -- delete the word after the cursor
  • Ctrl + D -- delete the character under the cursor (also exits the shell if the line is empty)

Ctrl + W is the most useful shortcut on this entire list. When you mistype a long path or argument, Ctrl+W deletes the last word instead of you holding backspace for 5 seconds.

Undo

  • Ctrl + _ (underscore) -- undo the last edit. Yes, the terminal has undo. Almost nobody knows this.

Command History: Stop Retyping Commands

Reverse Search (Ctrl + R)

Press Ctrl+R and start typing. The terminal searches backward through your history for matching commands. Press Ctrl+R again to cycle through older matches. Press Enter to execute, or right arrow to edit the command first.

This is the single biggest time saver in the terminal. If you ran a complex command 30 minutes ago, Ctrl+R finds it in seconds.

History Navigation

  • Up/Down arrows -- cycle through previous commands (you know this one)
  • !! -- repeat the last command. Most useful as \sudo !!\ when you forget to run something with sudo
  • !$ -- insert the last argument of the previous command. Incredibly useful:

> mkdir my-new-project

> cd !$

This creates the directory and then cds into it using the last argument.

  • !*: -- insert all arguments of the previous command
  • !n -- execute command number n from history (use \history\ to see numbers)

History Expansion

  • Alt + . -- insert the last argument of the previous command (interactive version of !$). Press it repeatedly to cycle through last arguments of older commands.

This is better than !$ because you can see what is being inserted before pressing Enter.


Process Control: Manage Running Commands

Basics

  • Ctrl + C -- kill the current process (you know this)
  • Ctrl + Z -- suspend the current process (move it to background). Resume with \fg\
  • Ctrl + D -- send EOF (end of file). Closes the shell or terminates input

Job Management

When you suspend a process with Ctrl+Z:

  • fg -- bring it back to the foreground
  • bg -- resume it in the background
  • jobs -- list all suspended/background jobs
  • kill %1 -- kill job number 1

This is useful when you accidentally start a long process and need to do something else without opening a new terminal. Ctrl+Z, do your thing, then \fg\ to go back.


Directory Navigation Shortcuts

cd Shortcuts

  • cd - -- go back to the previous directory. This is the terminal equivalent of the back button, and it is incredibly useful.
  • cd ~ -- go to home directory (you can also just type \cd\ with no arguments)
  • cd .. -- go up one directory (you know this, but consider aliasing it)

Useful Aliases

Add these to your shell config for faster navigation:

> alias ..="cd .."

> alias ...="cd ../.."

> alias ....="cd ../../.."

Now \...\ goes up two directories instantly.

pushd and popd

These commands maintain a stack of directories:

  • pushd /some/path -- go to /some/path and push your current directory onto the stack
  • popd -- go back to the directory on top of the stack

This is like bookmarking your current location before jumping somewhere else, then popping back when done.


Output Control

Scrolling

  • Shift + Page Up/Down -- scroll through terminal output
  • Ctrl + L -- clear the screen (same as the \clear\ command but faster)

Piping and Redirecting

These are not shortcuts in the keyboard sense, but they are workflow shortcuts every developer should know:

  • command | less -- view long output with scrolling. Press q to quit, / to search
  • command | head -20 -- show only the first 20 lines
  • command | tail -20 -- show only the last 20 lines
  • command | grep "pattern" -- filter output for lines matching a pattern
  • command > file.txt -- redirect output to a file (overwrites)
  • command >> file.txt -- append output to a file
  • command 2>&1 -- redirect stderr to stdout (combine all output)

Zsh-Specific Shortcuts

If you are using Zsh (the default on macOS), you get additional features:

Glob Qualifiers

  • ls *.js -- all JS files in current directory
  • ls /.js -- all JS files recursively (this is a Zsh feature, Bash needs \shopt -s globstar\*)

Auto-Correction

Zsh can auto-correct typos. If you type \gti status\ it will ask "did you mean git?" Enable it with:

> setopt correct

Directory History

  • d -- shows a numbered list of recently visited directories (if using Oh My Zsh)
  • Type the number to jump to that directory

Tmux: Terminal Multiplexing Shortcuts

If you use Tmux (and you should), these shortcuts dramatically improve your workflow:

Window Management (prefix is Ctrl+B by default)

  • Ctrl+B c -- create new window
  • Ctrl+B n -- next window
  • Ctrl+B p -- previous window
  • Ctrl+B 0-9 -- jump to window by number

Pane Management

  • Ctrl+B % -- split vertically
  • Ctrl+B " -- split horizontally
  • Ctrl+B arrow keys -- navigate between panes
  • Ctrl+B z -- zoom current pane (toggle fullscreen)

Session Management

  • Ctrl+B d -- detach from session (it keeps running in the background)
  • tmux attach -- reattach to the last session

Building the Habit

Start with these five. They cover 80% of the time savings:

  1. 1Ctrl + R -- search history
  2. 2Ctrl + W -- delete last word
  3. 3Ctrl + A / Ctrl + E -- jump to start/end of line
  4. 4Ctrl + U -- clear line before cursor
  5. 5cd - -- go to previous directory

Use them for one week until they are automatic. Then add five more from this list. Within a month, you will navigate the terminal without thinking.

The terminal is not a necessary evil. It is the most powerful interface on your computer. The only thing standing between you and that power is muscle memory.

For more developer tips, check out our blog and explore our free developer tools.

Explore Our Free Tools & Games

Check out our curated collection of completely free browser games, tools, and extensions.

Browse Free Stuff

More Articles

Developer ToolsJSON

Stop Squinting at Messy JSON - Format It Instantly (Free Tool Inside)

Messy JSON is a productivity killer. Learn why formatting matters, common JSON pitfalls developers hit daily, and try our free browser-based JSON Formatter that works instantly with zero sign-ups.

7 min readRead More→
Browser GamesFree Games

Best Free Browser Games You Can Play Right Now in 2025

Discover the top free browser games of 2025 that require no downloads, no installs, and no sign-ups. From puzzle games to multiplayer adventures, these games run right in your browser.

8 min readRead More→
Developer ToolsFree Tools

Free Developer Tools Every Programmer Needs in Their Toolkit

A comprehensive guide to the best free developer tools available online. From JSON formatters to regex testers, these browser-based tools will supercharge your productivity.

10 min readRead More→
Chrome ExtensionsProductivity

10 Free Chrome Extensions That Will Boost Your Productivity

These free Chrome extensions will transform how you browse, work, and manage your time online. From tab management to dark mode, these extensions are must-haves.

7 min readRead More→