How to be lazy-fast while using the command line. (Mac Version)

One word: aliases.

Basically, instead of typing a long command like git push origin master, with aliases setup, you could for example type only gpom and it would do the trick for you. Instead of git push production master, you can simply type gppm and you’re good to go! Such is the power of persistent aliases.

To get started, we would need a text editor like TextEdit or Sublime. Next, click on “File >>> Open…” and navigate to your home folder. Then, press [Shift] + [Cmd] + [.] one or two times until the ‘hidden files’ show up on the window. Click or open the .bashrc or .bash_profile file. Take your pick, either one would work. If you see .zshrc or you know for sure that you’re using .zsh, then open .zshrc or .zsh_aliases instead.

Next, paste or append the following snippet into the end of the open file.

# custom command shortcuts
alias cpl='clear && pwd && ls'
alias xxx='exit'

# getting rid of command not found error
alias cd~='~'
alias cd..='cd ..'

# getting out of the current directory
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias ......='cd ../../../../../'

# search in history
alias hs='history|grep'

# initiate python
alias p='python'

# jupyter
alias jn='jupyter notebook'

# Github shortcuts
alias gi='git init'
alias gs='git status'
alias ga='git add'
alias gcom='git commit -m'
alias grao='git remote add origin'
alias gplm='git pull origin master'
alias gpom='git push origin master'
alias gppm='git push production master'

Save the file, start a new terminal session, and test ’em out!