An alias is a one-time investment. You type it correctly once, add it to your shell config, and from that point forward it saves keystrokes every single day. The hard part isn't the syntax — it's knowing which ones are actually worth making permanent.
These 30 aliases are the ones that hold up: they cover git, navigation, file management, and the system shortcuts developers reach for constantly. Each one includes an explanation so you understand what you're adding to your shell, not just copying something opaque.
Contents
Aliases defined at the command line vanish when you close the terminal. To make one permanent, add it to ~/.bashrc (bash) or ~/.zshrc (zsh):
echo "alias ll='ls -lAh'" >> ~/.bashrc
source ~/.bashrc
The source command reloads the file in your current shell without restarting it. Or you can keep all your aliases in a separate ~/.bash_aliases file and load it from your ~/.bashrc:
# In ~/.bashrc:
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
This keeps your rc file clean and makes it easy to sync aliases across machines.
alias ll='ls -lAh'
alias la='ls -A'
-l is long format, -A shows hidden files (but not . and ..), -h makes sizes human-readable. ll is the single most-typed alias in most developers' configs.
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
Three dots drops you two levels up, four dots drops you three levels. Much faster than repeated cd .. when you're deep in a project tree.
alias ~='cd ~'
alias projects='cd ~/projects'
Adjust the path to wherever you actually keep your work. The goal is zero friction for your most-entered destinations.
alias dh='dirs -v | head -5'
Bash maintains a directory stack with pushd/popd. dirs -v shows it with indices. Use cd ~2 to jump to index 2.
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
The -i flag prompts before overwriting or deleting. This costs one keystroke on the rare occasions you're sure — and has saved countless files from fat-fingered rm commands. Some people disable these on servers where automation runs without a TTY; on a dev machine they're almost always worth keeping.
alias mkcd='_(){ mkdir -p "$1" && cd "$1"; }; _'
This is actually a tiny function disguised as an alias. The mkdir -p creates parent directories as needed. Use it: mkcd new-project/src/components.
alias bigfiles='find . -type f -size +10M | sort'
Scans the current directory tree for files over 10 MB. Adjust the threshold with +50M or +1G. Pair with ls -lh $(bigfiles) to see sizes.
alias ducks='du -sh */ 2>/dev/null | sort -h | tail -20'
sort -h understands human-readable suffixes (K, M, G). 2>/dev/null suppresses permission errors. This is the first thing to run when a disk fills up unexpectedly.
Git's long subcommands are the most natural target for aliases. These assume you're in a git repository — they don't add safety checks, so know what they do before you use them.
alias gs='git status'
alias gss='git status --short'
--short gives a compact two-column view: M for modified, ? for untracked. Good when you already know the broad state and just want to confirm.
alias ga='git add'
alias gaa='git add --all'
alias gc='git commit -m'
alias gca='git commit --amend --no-edit'
gc "message" lets you commit in one shot. gca amends the last commit without opening an editor — use it when you forgot to stage a file or made a typo in the commit. Only safe before you push.
alias gl='git log --oneline --graph --decorate -20'
alias gla='git log --oneline --graph --decorate --all'
gl shows the last 20 commits with a visual branch graph. gla shows all branches. These two together replace most of what a git GUI gives you.
alias gb='git branch'
alias gco='git checkout'
alias gcob='git checkout -b'
gcob feature-name creates and checks out a new branch in one step.
alias gp='git push'
alias gpu='git push -u origin HEAD'
alias gpl='git pull'
gpu pushes the current branch and sets its upstream in one command — useful when you create a new branch locally and want to push it for the first time.
alias gunstage='git reset HEAD~1 --soft'
Moves HEAD back one commit but leaves the files staged. Safe for undoing a premature commit. Don't use after pushing — use git revert for shared history.
alias psg='ps aux | grep -v grep | grep'
Usage: psg node. The grep -v grep filters out the grep process itself from the results. Faster than ps aux | grep X | grep -v grep every time.
alias listening='lsof -i -P -n | grep LISTEN'
Lists all open network ports with PID and process name. -P shows port numbers instead of service names, -n suppresses hostname lookups so it runs immediately.
alias reload='source ~/.bashrc'
After editing ~/.bashrc, one word reloads it. For zsh users: alias reload='source ~/.zshrc'.
alias myip='curl -s ifconfig.me'
Prints your public IP. Useful when debugging firewall rules or confirming a VPN is working.
# macOS
alias clip='fc -ln -1 | pbcopy'
# Linux (needs xclip)
alias clip='fc -ln -1 | xclip -selection clipboard'
fc -ln -1 prints the last command from history. Pipe it to a clipboard tool to paste it somewhere else — a Slack message, a Notion doc, a script.
alias serve='python3 -m http.server 8080'
Starts a static file server in the current directory. Works for previewing HTML files locally. Change the port if 8080 is taken.
alias ts='gawk "{print strftime(\"[%H:%M:%S]\"), \$0; fflush()}"'
Pipe slow commands through it: npm install | ts. Each line gets a timestamp prefix so you know how long each phase takes.
alias topcommands='history | awk "{print \$2}" | sort | uniq -c | sort -rn | head -20'
Run this after a few months with your current setup. The top results are your best alias candidates — anything in the top 10 that isn't already aliased probably should be.
Where do I put bash aliases to make them permanent?
Add them to ~/.bashrc (bash) or ~/.zshrc (zsh). After editing, run source ~/.bashrc so the current shell picks them up without restarting.
What is the difference between a bash alias and a bash function?
Aliases are simple text substitutions — use them for fixed commands with no arguments. Functions accept arguments and can contain logic, loops, and conditionals. If you need to pass arguments or run multiple commands with branching, write a function instead.
Can I use bash aliases in shell scripts?
By default, aliases are not expanded in non-interactive shell scripts. They work in interactive shells (your terminal). If you need reusable shortcuts in scripts, define them as functions in a sourced file instead.
How do I list all my current bash aliases?
Run alias with no arguments. It prints every alias defined in the current shell session, including those loaded from .bashrc.
These are the ones worth keeping. The real test: if you add an alias and keep reaching for the long form out of habit, delete it. Aliases only pay off if muscle memory catches up.
Next up: 25 bash one-liners for finding files, processing text, managing processes, and working with git.