Linux: How to Create Permanent Aliases
This post will guide you how to create a permanent bash shell alias under your linux bash shell. How do I make an alias permanent alias on CentOS/Ubuntu Linux.
You can use alias command to create a bash alias on Linux system, but it will be removed after rebooting your linux system. So you need tp put bash shell aliases into your .bashrc file. Do the following steps to create a permanent bash alias:
#1 edit your .bashrc profile using vi/vim test editor. type:
# vi ~/.bashrc
#2 adding your alias into the file, for example: creating a bash alias for rm command:
alias rm='rm -i'
#3 save and close the file.
#4 source your .bashrc file. type:
# source .bashrc
List All Aliases of Your Linux System
If you want to list all aliases in your linux bash shell, you can directly run alias command only, type:
# alias
Outputs:
devops@devops-osetc:~$ alias alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto'