You may be using aliases without knowing it if you use Linux, since a command as common as
ll is an alias that already comes by default in distributions like Ubuntu.
alias ll='ls -alF'
Alias is an old cross-platform command that in our beloved Unix has inherited it with zsh and bash.
Alias is by definition a command for command line interpreters (shells), where a word or string is replaced by another string.
Alias is used to abbreviate or add default arguments to a commonly used command.
To display the system aliases in Debian distributions, a
alias is sufficient for all other unix distributions
alias [-p] [name[=value] ... ]
Use of aliases
delete an alias
The use of aliases depends precisely on the use that we give him at session level, when you create an alias with the previous syntax, it is created for the active session, but if we close session or we restart the pc, these aliases will be erased.
If we want the aliases to be saved we will have to introduce them in the hidden file ~/.bashrc.
With our favorite editor we will do a
sudo nano ~/.bashrc to edit it and add our aliases. In any part of the document with this syntax
With a simple r and enter I am root
alias r='sudo -i'
If we want to generate a strong password under console I have programmed xxx and I get the password
alias xxx='openssl rand -base64 20'
To clear the cache memory in our Debian based distributions.
alias mem='sudo -i && sync && echo 3 > /proc/sys/vm/drop_caches'
So common in our systems
alias update='sudo apt update && sudo apt upgrade'
To know our public ip
alias ip='curl ipinfo.io/ip'
To view our open ports
alias p='netstat -tulanp'
The use of aliases is limited only by our imagination or needs, it is a very useful command for those who live in bash.
Posted with STEMGeeks