Register now or log in to join your professional community.
A Bash alias is essentially nothing more than a keyboard shortcut, an abbreviation, a means of avoiding typing a long command sequence.
Source: tldp.org/LDP/abs/html/aliases.html
Aliases are common in Linux/Unix shells but also in Windows Command Prompt and in PowerShell.
Bash aliases are useful to call a command with some specific options, to run a script / application or to read a personal help file in the shell.
The Bash aliases are in .bashrc (a 'dot' file where define your aliases, functions and other interactive features) but is better create and use a .bash_aliases file.
To read the bash' s aliases simple type alias that displays a list of all current aliases.
My preferred are:
alias su='su -p'
This invoke the su command (change user ID or become superuser) with the -p option to preserve the current environment.
alias rm='rm -iv'
This start rm (remove files or directories) in interactive and verbose mode to avoid to delete files by mistake.
Note that the -f (force) option ignore the interactive option.
alias re-source='source ~/.bashrc'
This reload all the bash configuration files.Useful when you modify them, like adding an alias, for the changes to take effect.
Ignore the alias with \\\\ or ' ' like: \\\\rm or 'rm'.
This, in Unix shells, override the rm alias.
Regards, Renzo