how to Bash alias code example
Example 1: bash how to set up aliases
1. Open the .bashrc file with your favorite shell text editor. E.g.
type "vi ~/.bashrc"
2. Define an alias on a new line using this basic syntax:
alias abbreviated_command='original -long -command'
E.g.: alias ls='ls --color -lhAFG'
3. Save and exit the .bashrc file (e.g. type ":q" and Enter in vi/vim)
4. Source the .bashrc file to apply/activate the alias. E.g.
type "source ~/.bashrc"
alias bashrc='vi ~/.bashrc'
alias sourcebash='source ~/.bashrc'
Example 2: will bash script use alias
shopt -s expand_aliases
alias ls1='ls -lrt'
ls1