.bashrc Alias on Linux: Examples for Server Admins

bashrc alias - custom-bashrc56-featured.png

bashrc alias shows up when admins want safer shortcuts on jump boxes — without rewriting muscle-memory commands. Shell series: bash basics; prefer functions for arguments (see below).

Where to put them

Interactive users: ~/.bashrc (often sources ~/.bash_aliases on Debian/Ubuntu).

bashsnippet
cat >> ~/.bash_aliases <<'EOF'
alias ll='ls -lah'
alias dfh='df -hT'
alias myip='ip -br a'
EOF
source ~/.bashrc
~/.bashrc
file

Safe patterns

Aliases with no arguments are fine; use functions when you need parameters.

bashfunction
mkcd() { mkdir -p "$1" && cd "$1"; }
function
safer

Reload

Open a new session or source ~/.bashrc — cron/non-interactive shells ignore aliases.

WarningScripts should call full paths (/usr/bin/grep) — never rely on aliases in cron.
source
reload

System-wide optional

Team defaults: /etc/profile.d/myaliases.sh (no secrets in there).

bashsystem
echo "alias v='vim'" | sudo tee /etc/profile.d/10-aliases.sh
profile.d
team

Quick Reference

Related tutorials

Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.