logo
AboutProjectslogoArticlesContact

© erickbooth.com

Terms of UsePrivacy Policy
Erick Booth - Full-Stack Developer
Shorten Your Terminal Commands with Bashrc
TerminalBashDX
Erick Booth

Erick Booth

Wed Jul 23 2025
 

Shorten Your Terminal Commands with Bashrc

Do you ever get tired of typing the same, old, long-winded terminal commands every day? Well, gather 'round, coders! I'm here to tell you about a little secret weapon that has literally changed my command-line game forever. That's right, we're talking about Bash aliases and the incredibly powerful .bashrc file. ✨

Some of you seasoned terminal wizards are probably rolling your eyes right now, but for the longest time, I was slogging through my terminal life, typing out long, repetitive commands like it's the 1970s. git status? npm run dev? cd ../../some/nested/directory/? My fingers ached, my soul despaired. 😩

How does it work?

Think of your .bashrc file as your personal command-line spellbook. Every time you open a new terminal session, your bash shell reads this file and loads up all your custom settings and, you guessed it, aliases! An alias is simply a shortcut. You tell Bash, "Hey, when I type gs, I actually mean git status."

Your alias definitions might look something like this:

alias nrd="npm run dev"
alias nrb="clear && npm run build"

Note how you can chain commands, such as clearing the terminal before executing the next command.

How to Get Started

Your bashrc file can be found at the following locations. If it doesn't exist yet, you can create it manually.

  • 🪟 Windows: C://Users/your_username/.bashrc
  • 🍎 MacOS: /Users/your_username/.bashrc
  • 🐧 Linux: ~/.bashrc

While you can certainly edit the file in-terminal via nano, I recommend opening it with your preferred code editor with an integrated terminal so that you can edit and test more seamlessly.

Add your preferred aliases one line after another like so:

alias gs="git status"
alias gp="git push"
alias ga="git add ."
alias nrd="clear && npm run dev"
alias nrt="clear && npm run test"
alias nrb="clear && npm run build"

You can even use a functional syntax to pass arguments to the alias template:

gcmnv() { 
  git commit -m "$1" --no-verify
}

Save the file, then restart your terminal.

Eh Voila! Your new aliases are ready to rock! 🎉

Developer Aliases You NEED in Your Life!

This is where the real fun begins! Think about all those repetitive commands you type daily. Here are some ideas to supercharge your development workflow:


Node / NPM / Yarn:

alias nr='npm run'
alias ni='npm install'
alias nis='npm install --save'
alias nrd='npm run dev'
alias nrs='npm run start'

Git:

alias gs='git status'
alias gc='git commit'
alias gcm='git commit -m'
alias gl='git log --oneline --graph --all'
alias gb='git branch'
alias gco='git checkout'
alias gd='git diff'

Navigation & Files:

alias ll='ls -alF'
alias ..='cd ..'
alias ...='cd ../..'
alias home='cd ~'
alias desk='cd ~/Desktop'

Docker:

alias dcup='docker-compose up -d'
alias dcdown='docker-compose down'
alias dclogs='docker-compose logs -f'

Your Project Specifics:

Maybe you have a project with a super long pathname:

alias myproj='cd ~/dev/projects/super_long_project_name/src/client'

A common build command?

alias buildweb='npm run build-webpack-prod'

Why This Matters for Your Dev Workflow

It's not just about saving keystrokes, though that's a huge win. It's about:

  • Reducing Cognitive Load: Less thinking about how to type a command, more thinking about what you're trying to achieve.
  • Preventing Typos: I don't know about you, but when other people start watching, I type like a 5 year old. 😭 Shorter commands mean fewer chances for pesky errors getting in the way or making you look bad.
  • Boosting Speed & Flow: You'll navigate your terminal and execute tasks with lightning speed, maintaining that precious "flow state." 🚀
  • Customizing Your Environment: Your terminal becomes truly yours, tailored to your unique development habits.

So, if you haven't dived into the glorious world of bash aliases yet, what are you waiting for? Open up that .bashrc file, unleash your creativity, and prepare to have your development workflow transformed. 🙌

Thanks for reading

Want share this article?

Browse more articles