DEV Community

LearnAI Resource
LearnAI Resource

Posted on

Stop Fighting Your Terminal: 5 Productivity Hacks That Actually Stick

Your terminal is probably costing you hours. Not because there is anything wrong with it—but because you are fighting against it instead of working with it.

I used to live in my editor. Switch to the terminal, hunt for commands, switch back. Repeat 50 times a day. Then I stopped being dumb about it and actually invested 30 minutes in fixing my setup. That single afternoon saved me weeks of wasted time.

Here's what actually works.

1. Stop Typing Paths Over and Over

If you're doing cd /path/to/project/backend/src multiple times a day, your setup is already broken.

Add this to your .zshrc or .bashrc:

alias proj="cd /path/to/project"
alias be="cd /path/to/project/backend"
alias fe="cd /path/to/project/frontend"
Enter fullscreen mode Exit fullscreen mode

Seriously. Just do it. Now proj takes you there instantly. Your fingers will thank you.

Better: Create a cd wrapper that searches for common directories:

function goto() {
  case $1 in
    proj) cd ~/projects/myapp ;;
    back) cd ~/projects/myapp/backend ;;
    front) cd ~/projects/myapp/frontend ;;
    *) cd ~/$1 ;;
  esac
}
Enter fullscreen mode Exit fullscreen mode

One line. Saves hundreds of keystrokes a week.

2. Master Your Command History (Actually)

Most developers leave command history on default settings. This is like leaving money on the table.

# In ~/.zshrc or ~/.bashrc
HISTSIZE=50000
SAVEHIST=50000
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
Enter fullscreen mode Exit fullscreen mode

Now when you hit Ctrl+R, it doesn't show you duplicates. Search once, find what you need. This alone cut my "searching for that command I ran yesterday" time by 80%.

Pro tip: Use fzf for fuzzy history search. Install it, add this to your shell config, and Ctrl+R becomes magical:

# Fuzzy history search (if you have fzf installed)
source ~/.fzf/shell/key-bindings.zsh
Enter fullscreen mode Exit fullscreen mode

3. Batch Commands That Belong Together

Every time you deploy something, you probably run 3-4 commands in sequence. Automate that.

function deploy() {
  npm run build && \
  npm run test && \
  git push && \
  echo "Deployed!"
}
Enter fullscreen mode Exit fullscreen mode

One command. Done. No more "did I forget to test before pushing?" anxiety.

Same thing for local development setup. Add this to your shell:

function devsetup() {
  git pull && npm install && npm run dev
}
Enter fullscreen mode Exit fullscreen mode

Now devsetup gets you fresh and running in one go.

4. Make Your Prompt Tell You What You Need to Know

Your terminal prompt is prime real estate. Use it.

If you're using oh-my-zsh or similar, you're probably showing your git branch, but what about showing:

  • Whether you have uncommitted changes (maybe a dot or color)
  • What environment you're in (dev vs prod matters!)
  • How long the last command took (if it was slow, you notice)

Here's a simple prompt that does actual work:

PROMPT='%F{blue}%~%f %F{green}$(git_branch)%f %F{yellow}$?%f %F{bold}❯%f '
Enter fullscreen mode Exit fullscreen mode

That's path (blue), git branch (green), last exit code (yellow), and a prompt. You can actually see when something broke without running a separate command.

5. Keep Your Most-Used Commands Visible

Create a simple reference file. Seriously.

# ~/.devcommands (or wherever)
# Database commands
db-reset: psql -U postgres mydb < schema.sql
db-seed: psql -U postgres mydb < seeds.sql

# Deploy commands
deploy-prod: npm run build && ./scripts/deploy.sh prod
deploy-staging: npm run build && ./scripts/deploy.sh staging

# Testing
test-all: npm run test && npm run lint
test-watch: npm run test -- --watch
Enter fullscreen mode Exit fullscreen mode

Don't memorize. Grep it:

function cmd() {
  cat ~/.devcommands | grep $1
}
Enter fullscreen mode Exit fullscreen mode

cmd db-reset shows you exactly what you need to type. Sounds lazy? You're right. Being lazy here is being smart.

The Real Move: 30 Minutes Now = Hours Later

The thing is, you already know these work. You've probably seen .bashrc customization before. The reason most developers don't do this is inertia—it feels like "setup work" which doesn't ship code.

But it does. It compounds. I can't measure exactly how much time that 30-minute terminal setup saves me, but I know it's significant. Every day, multiple times a day, I notice it.

Pick one of these. Add it today. Next week, add another. By next month your terminal won't feel like friction anymore—it'll feel like it's reading your mind.

And if you want to go deeper on productivity systems—debugging patterns, workflow automation, getting actual value from your tools—I write about that stuff every week in the LearnAI Weekly newsletter. Real patterns, no fluff.

Your terminal is waiting. Make it work for you.

Top comments (0)