Set Up Common Aliases
April 3, 2026
Instead of having all my aliases in .bashrc, I like to have the same system-level aliases available on all, or most, of my systems. We can achieve this in a few different ways. On Gentoo, I prefer adding the following file /etc/profile.d/10-system-alias.sh.
/etc/profile.d/10-system-alias.sh
#!/bin/bash
# These are system-wide aliases available to all users
# User-level aliases should be defined in each user's
# ~/.bashrc (or other shell init)
# ls shorthand
alias la="ls -alh"
alias lA="ls -Alh"
alias l1="ls -1h"
alias l="ls"
# cd shorthand
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../../'
# config shorthand
alias e.alias='nano -w /etc/profile.d/10-system-alias.sh && source /etc/profile'
alias e.make='nano -w /etc/portage/make.conf'
# define a default editor
# user's may or may not need to change EDITOR='nano' for instance
# in their ~/.bashrc
alias e="$EDITOR"
# spelling mistakes
alias clar="clear"
#
# default options
#
alias grep="grep --color=auto --text"
alias egrep='egrep --color=auto --text'
alias fgrep='fgrep --color=auto --text'
alias screen="export TERM=xterm; TERMINFO='/usr/share/terminfo/' /usr/bin/screen"
alias screen.sh="export TERM=xterm; TERMINFO='/usr/share/terminfo/' /usr/bin/screen -DR && exit"
alias path='echo -e ${PATH//:/\\n}'
## pass options to free ##
alias meminfo='free -m -l -t'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
## Get server cpu info ##
alias cpuinfo='lscpu'
# ssh
alias ssh.forget='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
Now we can make the file executable and source it.
chmod 755 /etc/profile.d/10-system-alias.sh
source ~/.bashrc
Now you can try a command like meminfo. With this method, you could maintain a central repository of system aliases with a version control system like git or configuration manager like ansible, depending on the size of your network.