Speeding up your Command Line Workflow


A typical day for the modern developer is never the same. And the speed in which you are able to navigate your computer is absolutely essential for keeping productivity at a maximum. But how do you manage your workflow to ensure that you don't end up spending half your time navigating directories?

Use Aliases!

Aliases are an incredibly effective way of speeding through your daily workflow. And they make you feel like a wizard. My bash profile is my savior day after day. But how, you ask, can one get started with setting up aliases, and what is an alias?

"An Alias is a keyboard shortcut that allows you to use the command line more efficiently"

Getting Started

Create your bash profile. Type nano bash_profile to open the .bash_profile document (or create one if it doesn’t already exist). Once you have this open copy the following commands at the top.

alias prof="subl ~/.bash_profile"  
alias reprof=". ~/.bash_profile"  

These will allow you to directly open and edit your bash profile from your terminal in sublime text, assuming you have a "subl" shortcut created. Feel free to use another shortcut for your favorite text editor. You can type prof in your terminal to open the bash profile document and once saved, typing reprof in your terminal will put those changes into effect.

Types of Aliases

One of the best ways to increase your efficiency of navigating around your computer is to set up some navigational aliases. This is a list of some typical navigational aliases I use on my personal machine.

alias dt="cd ~/Desktop/"  
alias dw="cd ~/Downloads"  
alias gh="cd ~/Desktop/Web/Github/"  
alias hr="cd ~/Desktop/Web/Github/Hack_Reactor/"  
alias toy="cd ~/Desktop/Web/Github/Hack_Reactor/2014-12-toy-problems"  
alias self="cd ~/Desktop/Web/Github/Hack_Reactor/self-assessments"  
alias ex="cd ~/exercism/javascript"  
alias euler="cd ~/Desktop/Web/Github/euler"  

As a software engineer, you will most assuredly be using some sort of version control system. These are the git aliases that I use to streamline this process dramatically.

alias ga="git add"  
alias gs="git status"  
alias gc="git commit"  
alias gb="git branch"  
alias gp="git push"  
alias gf="git fetch"  
alias gfu="git fetch upstream"  
alias gcb="git checkout -b"  
alias gch="git checkout"  
alias gchm="git checkout master"  
alias gpo="git push origin"  
alias gpom="git push origin master"  
alias gpum="git pull upstream master"  
alias gp="git push"  
alias gpl="git pull"  
alias gpr="git log --pretty=format:'%Cblue%h%Creset %Cgreen%ad%Creset | %s%C(yellow)%d%Creset [%an]' --graph --date=short --decorate"  
alias gd="git diff"  
alias gcl="git clone"  
alias gm="git merge"  
alias gr="git reset"  
alias grb="git rebase"  
alias grbm="git rebase master"  
alias grbc="git rebase --continue"  
alias grv="git remote -v"  
alias gacm="git add .; git commit -m"  
alias gundo="git reset HEAD~"  
Application Shortcuts

Here are some basic shortcuts for opening applications. If you want to open file or directory in your browser, your always just a line away.


chrome () {  
  open -a "Google Chrome" "$1"


ff () {  
  open -a "Firefox" "$1"


slack () {  
  open -a "Slack"


skype () {  
  open -a "Skype"


spot () {  
  open -a "Spotify"
Functional Shortcuts

Some quick one liners that make you smile every time.

Create a directory and enter it immediately

mkcd () {  
  mkdir $1
  cd $1

Clear your terminal

alias cl="clear"  


alias npmi="npm install"  
alias npmig="npm install -g"  

Create a file and open it in Sublime

tosu () {  
  touch "$1"
  subl "$1"

Aliases are incredibly helpful in developing a terminal workflow that allows you to move through your computer at blazing speeds. Get in touch if you need any help setting up your bash profile or would like any advice with creating your own aliases!

comments powered by Disqus