DEV Community


Posted on • Updated on

Do you even alias, bro?

I'm proud of the pun in the title. Sorry not sorry ;)

It's a fact, we live in the command-line.

There was a time (and I don't regret that) where using the command line for web development was a "strange thing"; the console was for the sysadmins.

But the times are a changin', and between git, npm, webpack and all that marvellous tools, we live in the command line.

There's plenty tools to help you take the better of your terminal, such as a better shell than bash, like zsh or fish, multiplexers, like tmux, and even complete frameworks to enhance your experience.

But the most useful feature of a terminal, hands down, are the aliases.

An alias is as simple as it sounds: it's a command you type as a shortcut for a longer command. Like typing l for ls -FalH, or .. for cd ...

Creating aliases is easy: for bash, zsh or fish.

I can't recommend you enough to create your own aliases, since they tend to be personal, but when you take a look at dotfiles, you'll see many common aliases.

Here's a list of some of my favorite aliases. You can find a complete list in my dotfiles repository.

Navigation & listing

Git aliases

  • git = hub (not really an alias, but if you work with GitHub a lot, it's wonderful)
  • gs = git status -sb
  • gap = git add -p (git add with patch mode)
  • grhh = git reset HEAD --hard
  • gcdf = git clean -fd (clean untracked files)
  • cdg = cd $(git rev-parse --show-toplevel) (cd to the root of the repository)

npm aliases

  • ni = npm install
  • nid = npm install --only=dev (only devDepencies)
  • nip = npm install --only=prod (only dependencies)
  • nis = npm install --save
  • nisd = npm install --save-dev
  • nci = npm ci


I hope some of these can be as useful to you that they are for me.

Don't hesitate to submit your favorite aliases here or in an article on your own! It's always interesting to see what are the best shortcuts of others!

Top comments (0)