Linux Shell Aliases I Use

Over time, I realized most of my terminal time was spent memorizing and repeating the same commands. So, I curated a set of shell aliases that make my terminal work for me.
What is an alias and how I use it in practice
An alias is simply a shortcut for a longer command. Instead of typing the full command every time, the shell expands the alias into the actual command before executing it.
For example:
bashalias gs='git status'
When I type gs and hit enter, the shell replaces it with git status and runs it. There is no magic and no performance cost. It is just text substitution handled by the shell.
I define these aliases in my .aliases at root directory and source it in my .zshrc, so they are available in every terminal session. If an alias does not get used regularly, I remove it. The goal is habit, not novelty.
Git aliases I rely on
During my recent internship, I noticed I cannot completely rely on git vscode extension and got to see the power of git with shell commands. These are the ones I use the most:
bashalias gs='git status' alias gl='git pull' alias ga='git add' alias gc='git commit -m' alias gp='git push' alias gamend='git commit --amend --no-edit' alias gundo='git reset --soft HEAD~1' alias gsw='git switch' alias gsm='git switch master' alias gco='git checkout' alias gcm='git checkout main' alias gb='git branch' alias gcl='git clone' alias glog='git log --oneline --graph --all' alias gd='git diff'
tmux shortcuts
Tmux is no less than a super-power. With these aliases, Session management became muscle memory instead of something I had to look up.
bashalias tn='tmux new -s' alias tl='tmux ls' alias ta='tmux attach-session -t' alias tk='tmux kill-session -t' alias tks='tmux kill-server'
Navigation through directories
Have you heard of 80/20 rule? People use these 20% of the commands 80% of times. Makes your linux life flow like butter.
bashalias ..='cd ..' alias ...='cd ../..' alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' alias c='clear' alias h='history' alias mkdir='mkdir -pv' alias cp='cp -i' alias mv='mv -i' alias rm='rm -i' alias grep='grep --color=auto'
Docker
Writing docker-compose and docker-exec repeatedly is a pain most of us share. One of the best use cases for aliases is Docker, where commands get long very quickly.
bashalias d='docker' alias dc='docker compose' alias dps='docker ps' alias dpsa='docker ps -a' alias di='docker images' alias db='docker build .' alias dba='docker build -t' alias drm='docker rm' alias drmi='docker rmi' alias dexec='docker exec -it' alias dlogs='docker logs -f' alias dcexec='docker compose exec api bash'
Django workflow
These mirror what I type most during django development (optional)
bashalias dj='python manage.py' alias djrun='python manage.py runserver' alias djmmig='python manage.py makemigrations' alias djmig='python manage.py migrate' alias djs='python manage.py shell' alias djt='python manage.py test'
Small utilities
These are commands I used to forget or mistype the most, now reduced to single words.
bashalias myip='curl ifconfig.me' alias ping='ping -c 5' alias ports='netstat -tulanp' alias please='sudo $(fc -ln -1)' alias v='vim' alias zshrc='source ~/.zshrc'
None of these aliases are groundbreaking on their own. But together, they made my terminal calmer, safer, and faster. I add aliases slowly now and only keep the ones I genuinely use.
