Stop Wasting Time in the Terminal: Linux Aliases Every Developer Should Know
How much time do you spend typing the same terminal commands every day?
If you're entering git commit -m, npm run dev, or navigating through directories for the hundredth time this week, you're spending energy on repetition instead of development.
Your terminal should be your fastest tool — not a bottleneck.
The solution is simple: Aliases.
Aliases are custom shortcuts that map a short command to a longer one. Add a few lines to your shell configuration (.bashrc, .zshrc) and you'll remove thousands of unnecessary keystrokes from your workflow over time.
Over a year, these tiny optimizations compound into hours of saved time and reduced friction.
What Is an Alias?
An alias follows a simple structure:
alias shortcut="actual_command"
Example:
alias gs="git status"
Now instead of typing:
git status
You only type:
gs
Small change. Huge effect.
1. Essential Navigation Shortcuts
Directory navigation is something every developer does constantly. Shaving even a second from repetitive movement matters.
Navigation Aliases
# Move up directories quickly
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# Better directory listing
alias ll="ls -lah --color=auto"
alias ls="ls --color=auto"
What these do
| Alias | Command | Purpose |
|---|---|---|
.. |
cd .. |
Go back one directory |
... |
cd ../.. |
Go back two directories |
.... |
cd ../../.. |
Go back three directories |
ll |
ls -lah |
Detailed file listing |
ls |
ls --color=auto |
Colorized output |
Why ll is useful
Instead of:
-rw-r--r-- 1 user user 2400000 Jan 20 file.txt
You'll see:
-rw-r--r-- 1 user user 2.4M Jan 20 file.txt
Much easier to scan.
2. Web Developer Lifesavers
If you build web applications, you've probably experienced this:
- Node crashes
- Next.js hangs
- Vite refuses to start
- Port
3000is already in use
Instead of manually searching for process IDs:
lsof -i :3000
kill -9 PID
Create instant shortcuts.
Port Killers
# Kill processes occupying common development ports
alias kill3000="kill -9 \$(lsof -t -i:3000)"
alias kill8080="kill -9 \$(lsof -t -i:8080)"
Now simply run:
kill3000
Done.
How this works
The command:
lsof -t -i:3000
silently retrieves the process ID running on port 3000.
That ID is immediately passed into:
kill -9
which terminates the process.
Flow:
Find Process → Extract PID → Kill Process
NPM Shortcuts
alias nrd="npm run dev"
alias nrb="npm run build"
alias ns="npm start"
Instead of:
npm run dev
You write:
nrd
After hundreds of executions, your fingers will appreciate it.
3. Git on Autopilot
Git usually consumes a large portion of terminal usage.
These shortcuts significantly reduce repetitive typing.
Daily Git Workflow Aliases
alias gs="git status"
alias ga="git add ."
alias gc="git commit -m"
alias gp="git push origin"
alias gpo="git pull origin"
Typical Workflow
Instead of:
git status
git add .
git commit -m "Added authentication"
git push origin main
You can do:
gs
ga
gc "Added authentication"
gp main
Cleaner and faster.
4. Beautiful Git History Visualization
The default git log output becomes difficult to read as projects grow.
This alias creates a cleaner commit graph.
alias glog="git log --graph \
--pretty=format:'%Cred%h%Creset \
-%C(yellow)%d%Creset %s \
%Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit"
Example Output
* a12b45f - Added authentication (2 hours ago) <Priyansh>
* e45c789 - Fixed navbar bug (1 day ago) <Priyansh>
* c87d123 - Initial project setup (3 days ago) <Priyansh>
Benefits:
✅ Colorized output
✅ Commit graph visualization
✅ Relative timestamps
✅ Author information
✅ Easier branch tracking
5. System Maintenance Commands
Keep your machine healthy without remembering long commands.
Update and Cleanup Shortcuts
# Debian / Ubuntu systems
alias update="sudo apt update && sudo apt upgrade -y"
alias clean="sudo apt autoremove -y && sudo apt clean"
What they do
update
sudo apt update
sudo apt upgrade -y
Updates package lists and installs upgrades.
clean
sudo apt autoremove -y
sudo apt clean
Removes unnecessary packages and clears package cache.
6. Reload Shell Configuration Instantly
After adding aliases, you normally need to reload your shell.
alias reload="source ~/.bashrc"
For Zsh:
alias reload="source ~/.zshrc"
Instead of closing and reopening your terminal:
reload
Changes apply immediately.
Bonus Aliases Worth Stealing
These are useful additions many developers eventually adopt:
# Clear terminal
alias c="clear"
# Current public IP
alias myip="curl ifconfig.me"
# Create a directory and enter it immediately
mkcd() {
mkdir -p "$1"
cd "$1"
}
# Quick disk usage
alias duh="du -sh *"
# Show PATH entries line-by-line
alias path='echo $PATH | tr ":" "\n"'
# Restart shell session
alias restart="exec $SHELL"
How to Add These Aliases
1. Open your shell configuration file
For Bash:
nano ~/.bashrc
For Zsh:
nano ~/.zshrc
2. Paste your aliases at the bottom
Example:
alias gs="git status"
alias nrd="npm run dev"
alias kill3000="kill -9 \$(lsof -t -i:3000)"
3. Save the file
Press:
CTRL + X
Y
Enter
4. Reload configuration
source ~/.bashrc
or:
reload
Final Thoughts
Aliases seem insignificant at first.
Saving 2–5 seconds on a command doesn't feel important — until you realize you execute many of those commands hundreds of times every week.
Small optimizations compound:
- Less typing
- Less context switching
- Faster workflows
- Lower friction
- More time building things
Your terminal should feel like an extension of your brain, not a place where you repeat the same commands endlessly.
What is the one terminal alias you refuse to work without?
Top comments (1)
Aliases are genuinely one of those things where the gap between a beginner and a
seasoned operator is just... visible in their .bashrc.
Here's what I'd add from years of security research and tool development:
── The "what is this machine actually doing" tier ─────────
alias listeners="ss -tlnp"
alias established="ss -tnp state established"
alias sysfail="systemctl --failed"
alias zombie="ps aux | awk '\$8==\"Z\"'"
alias recent="find . -mmin -60 -type f | sort"
alias suid="find / -perm -4000 -type f 2>/dev/null"
alias loginwatch="sudo lastlog | grep -v 'Never'"
alias failauth="sudo journalctl -u ssh | grep -i 'failed|invalid' | tail -20"
── The "I don't trust my own repo" tier ───────────────────
alias gsecrets="git log -p | grep -iE 'password|secret|token|api' | head -30"
alias gundolast="git reset --soft HEAD~1"
alias gdangling="git fsck --lost-found"
alias gcleanup="git branch --merged | grep -v '*|main|master|dev' | xargs git branch -d"
── The "on every machine within 5 minutes" tier ───────────
alias mk="make -j$(nproc)"
alias activate="source .venv/bin/activate"
alias venv="python3 -m venv .venv && source .venv/bin/activate"
Functions (the alias graduates)
whosport() { sudo lsof -i :"$1" -sTCP:LISTEN; }
bak() { cp "$1" "${1}.$(date +%Y%m%d_%H%M%S).bak"; }
b64e() { echo -n "$1" | base64; }
b64d() { echo -n "$1" | base64 -d; }
extract() {
case "$1" in
.tar.gz|.tgz) tar xzf "$1" ;; *.tar.xz) tar xJf "$1" ;;
*.zip) unzip "$1" ;; *.7z) 7z x "$1" ;;
*) echo "unknown format: $1" ;;
esac
}
The ones that have caught real issues: gsecrets (accidentally committed creds in
repo history survive a .gitignore fix this finds them), suid (SUID files that
shouldn't exist), and loginwatch (accounts with shell access that have never
logged in are worth auditing).
bak() is the one I evangelize most. Timestamped, non-destructive, no thought
required. It's replaced "let me just quickly rename this" for me entirely.
Your terminal should answer "what is this machine doing right now" just as fast
as it answers "where are my files." The aliases that do that are the ones worth
keeping.