Tips & Tricks

5 Terminal Tricks That'll Save You Hours

5 Terminal Tricks That'll Save You Hours

Cover: 5 Terminal Tricks That'll Save You Hours

None of these require a config overhaul or a new shell. They're small habits that quietly save you from retyping the same things over and over.

1. Reverse search your history

Press Ctrl + R and start typing part of a command you ran before. Bash and Zsh will search backward through your history and surface the closest match — keep pressing Ctrl + R to cycle through older matches. This alone eliminates most scrolling through history with the up arrow.

2. Jump to the last argument

Alt + . (or Esc then .) inserts the last argument of your previous command. After running mkdir new-project, typing cd and pressing Alt + . drops in new-project for you — handy for the "create it, then immediately go into it" pattern.

3. Brace expansion for repetitive paths

Instead of typing a directory path three times, brace expansion lets you write it once:

  • mkdir -p project/{src,tests,docs} creates all three folders in one line.
  • cp config.yml{,.backup} copies config.yml to config.yml.backup without retyping the filename.

4. Two aliases worth adding today

Drop these into your .bashrc or .zshrc:

  • alias ..='cd ..' — one less thing to type for the most common navigation move.
  • alias ll='ls -lahF' — a detailed, human-readable listing with file-type indicators, without typing the flags every time.
Worth knowing: after editing your .bashrc or .zshrc, run source ~/.bashrc (or the equivalent) to load the changes into your current session instead of opening a new terminal window.

5. Undo a destructive "cd" with one command

cd - takes you back to the previous directory you were in — useful when you jump somewhere to check one file and want to return without retyping the original path.

Comments