DEV Community

Cover image for ๐Ÿš€ Stop Typing Long Terminal Commands. Use Aliases Instead
Aditya
Aditya

Posted on

๐Ÿš€ Stop Typing Long Terminal Commands. Use Aliases Instead

As developers, we optimize APIs, databases, and smart contracts.

But we rarely optimize our own workflow.

I realized I was typing the same commands every single day:

  • npm run dev
  • git add .
  • git commit -m "message"
  • git push
  • docker compose up --build
  • npx hardhat test
  • forge build

It seems small.

But friction compounds.

So I reduced it.


๐Ÿง  What Are Shell Aliases?

Aliases are shortcuts you define in your shell (bash or zsh) that map short commands to longer ones.

Instead of typing:

npm run dev
Enter fullscreen mode Exit fullscreen mode

You type:

nd
Enter fullscreen mode Exit fullscreen mode

Same result. Less friction.


๐Ÿ›  Step 1: Open Your Shell Config

If youโ€™re using:

Zsh (Mac / Linux default nowadays)

nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Bash

nano ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

โœ Step 2: Add Aliases

Here are some practical ones for Full-Stack + Web3 developers:

# ๐Ÿ“ฆ NPM
alias nd="npm run dev"
alias nb="npm run build"
alias ni="npm install"

# ๐ŸŒฟ Git
alias gs="git status"
alias ga="git add ."
alias gc="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias gcb="git checkout -b"
alias gl="git log --oneline"

# ๐Ÿณ Docker
alias dcu="docker compose up"
alias dcub="docker compose up --build"
alias dcd="docker compose down"
alias dps="docker ps"

# ๐Ÿ” Hardhat
alias hhc="npx hardhat compile"
alias hht="npx hardhat test"
alias hhn="npx hardhat node"

# โš’ Forge
alias fb="forge build"
alias ft="forge test"
Enter fullscreen mode Exit fullscreen mode

Save the file.

Then reload:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

(Or source ~/.bashrc)

Done.


๐Ÿ”ฅ Real Before vs After

Before

git add .
git commit -m "fix: JWT verification bug"
git push
Enter fullscreen mode Exit fullscreen mode

After

ga
gc "fix: JWT verification bug"
gp
Enter fullscreen mode Exit fullscreen mode

Before

docker compose up --build
Enter fullscreen mode Exit fullscreen mode

After

dcub
Enter fullscreen mode Exit fullscreen mode

Before

git checkout -b feature/jwt-auth
Enter fullscreen mode Exit fullscreen mode

After

gcb feature/jwt-auth
Enter fullscreen mode Exit fullscreen mode

โšก Level 2: Combine Commands

You can even chain commands:

alias gacp="git add . && git commit -m"
Enter fullscreen mode Exit fullscreen mode

Now:

gacp "feat: add middleware"
gp
Enter fullscreen mode Exit fullscreen mode

One step closer to flow state.


๐ŸŽฏ Why This Matters

This isnโ€™t about saving 3 seconds.

Itโ€™s about reducing cognitive load.

When friction decreases:

  • You stay in flow longer
  • You ship faster
  • You feel less drained

Most developers try to optimize performance.

Few optimize themselves.


๐Ÿงฉ Bonus: Modern Git Alternative

Instead of:

git checkout -b feature/auth
Enter fullscreen mode Exit fullscreen mode

You can use:

git switch -c feature/auth
Enter fullscreen mode Exit fullscreen mode

And alias it:

alias gsw="git switch -c"
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ญ Final Thought

Productivity isnโ€™t about working more hours.

Itโ€™s about removing unnecessary resistance from your system.

If youโ€™re a developer:

Whatโ€™s one shortcut you canโ€™t live without?

Top comments (0)