OOZOU
與我們聯繫
Back to Blog

Aliasing All the Things to Improve Your Development Experience

If you're in programming for the long run, alias all the things. Trust me, it's going to save your fingers and improve your day-to-day life as a developer.

July 29, 2020
4 min read
Aliasing All the Things to Improve Your Development Experience

I've been in web development for close to 15 years, I'm still surprised how infrequently people use aliases. I use aliases for everything - I even have a bash function to create new aliases on the fly. As a developer, you are going to be typing... a lot. Help yourself out by aliasing all the things you type over and over again. Let the computer work for you - that's why we made them, right?

What is an alias?

I'm specifically talking about terminal commands here, be it bash or zsh, or even git. Aliases are really simple to configure and will save you days of typing over your career, your fingers will thank you.

How do I set up aliases?

I personally have a single file for all of my zsh aliases (works the same for bash) where I store everything related to aliasing. In my zsh config file I source this file which makes my aliases accessible when I start a new terminal session. First let's create the aliases file and source it in our .zshrc or .bashrc file.

touch ~/.aliases
``` ```bash
source $HOME/.aliases

I recommend also setting up your EDITOR if you haven't already done that. I use macvim locally and vi while ssh'ing so I use the following snippet at the top of my .zshrc file

# ~/.zshrc
if [[ -n $SSH_CONNECTION ]]; then
  export EDITOR=vi
else
  # the -c flag will run the following command when opening the new macvim window
  # the command will return us to iTerm after we close the macvim window
  export EDITOR='mvim -f -c "au VimLeave * !open -a iTerm"'
fi

Now that we have that set up let's set up some aliases! First thing I suggest is adding a function to add aliases on the fly

# ~/.aliases
addalias() {
  echo 'alias '$1'="'$2'"' >> ~/.aliases
  source ~/.aliases
}

This is a pretty basic function, it just takes 2 arguments, appends them to your aliases file and then sources the file to include the new alias in your current terminal session. e.g.

addalias rr "bin/rails routes"

Now we can call

rr | grep users

Which will find all the routes which include the substring, users. Using addalias after typing the same command over and over again while debugging or doing some repetitive task is extremely satisfying

Some of my most used aliases

# ~/.aliases
alias la='ls -a'
alias ll='ls -al'

alias zshconfig="$EDITOR ~/.zshrc"
alias ohmyzsh="$EDITOR ~/.oh-my-zsh"
alias vimconfig="$EDITOR ~/.vimrc"
alias sshconfig="$EDITOR ~/.ssh/config"
alias aliases="$EDITOR ~/.aliases"

alias g='git'
alias gx="gitx"

alias push="git push origin HEAD"
alias ppr="push && git pull-request -c"
alias pprm="push && git pull-request -c -m"
alias pr="git pull-request -c"
alias prm="git pull-request -c -m"

alias b='bundle'
alias bi='b install'
alias bu='b update'
alias be='b exec'

alias spring="be spring"
alias sidekiq="bundle exec sidekiq"
alias rspec='be rspec --no-profile'
alias rspecp='be rspec'
alias wds='bin/webpack-dev-server'
alias guard='be guard'

Aliasing git commands

In my experience most developers are aware of Git's capabilities but somehow overlook the aliasing abilities. Maybe it's because most people use a GUI - I don't know, but for me Git aliases are a must. Here are some of mine

# ~/.gitconfig
[alias]
	a  = add
	aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort
	b  = branch
	c  = commit
	cm = commit -m
	ca = commit -C HEAD --amend
	co = checkout
	cp = cherry-pick
	dt = difftool
	l = log
	mt = mergetool
	p  = push
	pr = pull-request -m
	ra = rebase --abort
	rc = rebase --continue
	ri = rebase -i
	rs = rebase --skip
	s  = status

Using aliases

I use most of these daily, after a while they become muscle memory. As a ruby developer I spend a lot of time in the terminal, both in the rails console and committing my work. With aliases my commands are a lot shorter e.g.

git check-out -b chore/new_branch
g co -b chore/new_branch

bin/rails c
r c

git status
g s

gitx
gx

I also use them to replace knowledge I struggle to internalize. For some reason I can never remember where the ssh config is stored, but I can easily remember an alias so I created sshconfig and now I don't need to look it up every time I want to modify the file.

alias sshconfig="$EDITOR ~/.ssh/config"

If this is something that interests you I highly recommend learning some bash scripting too, it's impressive how far you can get with a little knowledge.

Related Articles

How Can I Design a Software: A Beginners Guide for Business Owners

How Can I Design a Software: A Beginners Guide for Business Owners

Designing software is an exciting yet complex process that involves creativity, logical thinking, and problem-solving skills.

Read More →
The Future of Edge Computing: What Businesses Need to Know

The Future of Edge Computing: What Businesses Need to Know

The digital landscape is evolving rapidly, and businesses must adapt to keep up with rising demands for speed, efficiency, and real-time processing.

Read More →
The Future of Retail: AI, AR, and Digital Transformation Trends

The Future of Retail: AI, AR, and Digital Transformation Trends

Retail is evolving at an unprecedented pace, driven by AI (Artificial Intelligence), AR (Augmented Reality), and digital transformation technologies, revolutionizing the retail industry. Traditional brick-and-mortar stores are no longer just about selling products—they are becoming smart, interactiv

Read More →

Have a Project in Mind?

Let's discuss how we can help bring your ideas to life with our expertise in web and mobile development.

開始對話hello@oozou.com
OOZOU Logo

曼谷 · 新加坡 · 香港

X
Facebook
Instagram
LinkedIn

服務

  • Web 開發
  • AI 代理人與生成式 AI
  • 行動應用開發
  • 數據分析與工程
  • UI/UX 與產品設計
  • 數位轉型

公司

  • 關於我們
  • 職涯
  • 部落格
  • 案例研究
  • Today I Learned
  • 聯繫我們

更多

  • 產業
  • 合作夥伴網絡
© 2026 OOZOU. 版權所有。
隱私政策行為準則反賄賂反貪腐政策