Using a bash alias can save a lot of typing or having to copy and paste commands that you use all the time. Some people also use scripts, I’m not one of those. All you have to do is add to your .bashrc file in the Home directory, or if you’re using a flavor of Ubuntu, you have the option to put them in .bash-aliases. Aliases are pretty easy to setup, just use the alias name='value' format.

Here is a list of my bash aliases that I use quite often, modify to suit your needs and add to the bottom of the respected file:

# Aliases

# ccache
alias cs='ccache -s' # see ccache stats
alias cw='ccache -Cz' # wipe ccache clean

# Devices
alias crosshatch='cd /src/sr4/device/google/crosshatch'
alias blueline='cd /src/sr4/device/google/blueline'
alias bluecross='cd /src/sr4/kernel/google/bluecross'
alias usbc='git fetch android-msm-bluecross-4.9 && git merge FETCH_HEAD'

# Directories
alias cd1='cd ..'
alias cd2='cd ../../'
alias cd3='cd ../../../'

# Flashing
alias out='cd /out/sr4/target/product/crosshatch'
alias fast='adb reboot bootloader'
alias rec='adb reboot recovery'
alias flash='adb sideload S*.zip'

# Gerrit
alias rp='repopick'
alias hooks='gitdir=$(git rev-parse --git-dir); scp -p -P 29418 ${gitdir}/hooks/'

# Git
alias gs='git status'
alias gd='git diff'
alias gc='git clone'
alias gco='git checkout'
alias gb='git branch'
alias gp='git push'
alias gca='git commit --amend'
alias gl1='git log --oneline'
alias gr='git remote -v'
alias gra='git remote add'
alias gf='git fetch'
alias gcp='git cherry-pick'
alias gcpc='git cherry-pick --continue'
alias gcpa='git cherry-pick --abort'
alias gmc='git merge --continue'
alias gma='git merge --abort'
alias grbi='git rebase -i'
alias grbc='git rebase --continue'

# Repos
alias syncup='repo sync -j$( nproc --all ) -c --force-sync --no-clone-bundle --no-tags'
alias synclow='repo sync -j1 -c --no-clone-bundle --no-tags'
alias srx='cd /src/sr4'
alias manifest='cd /src/sr4/.repo/manifests'
alias build='cd /src/sr4/build/make'
alias soong='cd /src/sr4/build/soong'
alias fwb='cd /src/sr4/frameworks/base'
alias settings='cd /src/sr4/packages/apps/Settings'
alias scorpion='cd /src/sr4/vendor/scorpion'
alias themes='cd /src/sr4/vendor/themes'
alias duthemes='cd /src/sr4/packages/apps/DU-Themes'
alias extgoog='cd /src/sr4/external/google'
alias extras='cd /src/sr4/vendor/extras'

alias envs='source build/'
alias mkrom='make -j$( nproc --all ) bacon'
alias mkboot='make -j$( nproc --all ) bootimage'
alias mkclean='make -j$( nproc --all ) clean'
alias mkdirty='make -j$( nproc --all ) installclean && mkrom'
alias cleanout='rm -rf /out/sr4/target/product/*'