Adding Aliases of Commands

alias is the shortcut for long commands. It may also be used to display the already defined aliases depending with the Linux Distribution.

User may use the alias to save time and increase efficiency since long commands might take long typing or syntax error a rising.

alias option -p or alias with no option can be used to display all defined aliases. Some Linux distribution only accept alias with no options such as Kali Linux version 2021.2

alias available

 

Creating aliases

Firstly, we display the available aliases in Ubuntu alias -p and in Kali Linux version 2021.2 and greater alias

Syntax : alias [ alias name ] = “command”

alias n_stealth = "sudo nmap -sS scanme.nmap.org" Stealth scan by nmap to the subdomain on scanme

When n_stealth is executed nmap scans the targeted option.

Removing an alias

User is also given an option to remove an alias created by using unalias.

syntax :  unalias -a option a will remove all aliases defined or available in your system.

                unalias [alias name] the second method is by specifying the alias name that you want to be removed.

unalias n_stealth removes the previously defined alias.

In conclusion, we have seen how creating aliases can help in saving time, increasing efficiency and great reduction of command errors or syntax errors.

Leave a Reply

Your email address will not be published.