How to speed up your Linux workflow using alias
In Linux, there’s a handy feature called alias. These are shorthand commands that save time and eliminate the need to repeatedly type long command sequences.
📌 Check existing aliases
alias
This will display all configured shortcuts, for example:
ll='ls -alF'
📌Temporary alias (works until the terminal is closed)
alias wr="cd /var/www/html"
Now wr will take you directly to /var/www/html.
To remove it:
unalias wr
📌Persistent alias (survives reboots)
You need to add it to your shell configuration file:
Bash →
~/.bashrcZsh →
~/.zshrcFish →
~/.config/fish/config.fish
Example for ~/.bashrc:
alias gs="git status"
alias update="sudo apt update && sudo apt upgrade -y"
alias serve="python3 -m http.server"
alias ..="cd .."
alias ...="cd ../.."
To apply changes immediately:
source ~/.bashrc
📌Separate file: ~/.bash_aliases
Depending on your shell, the file may have a different name.
On Ubuntu/Debian systems, aliases are often stored in ~/.bash_aliases. All aliases are stored in the .bashrc file just add them there:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
This helps keep configurations clean and organized.
📌Useful alias examples
alias gs="git status"
alias gp="git pull"
alias update="sudo apt update && sudo apt upgrade -y"
alias serve="python3 -m http.server"
alias ..="cd .."More examples:
Display IP:
alias myip="ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
Secure file deletion (irreversible):
alias rm="shred -uzvn100"
Open the most recently edited file with nano:
alias lastfile="nano $(ls -t | head -1)"
Download files in the background with progress display:
alias wget="wget -c -q --show-progress -b"
Copy files with progress display:
alias cpv="rsync -ah --info=progress2"
Check open ports:
alias check-port="sudo netstat -tulanp"
Navigate back through directories using dots:
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
Shortcuts for apt commands:
alias sai="sudo apt install"
alias sau="sudo apt update"
alias saupg="sudo apt upgrade"
alias sas="apt-cache search"
Listen to music from YouTube:
alias workmusic='mpv --no-video "https://www.youtube.com"'
alias workmusic.stop='pkill -f "mpv --no-video http"'
Send 5 pings to a specified address:
alias ping='ping -c 5'
Manage TMUX sessions:
alias tas="tmux attach-session"
alias tls="tmux list-sessions"
alias tat="tmux attach -t"
alias tk="tmux kill-session"
alias n="tmux new-session -s"
