How To Make A Permanent Alias In Kali Linux

Since the Linux operating system is based almost entirely on terminal commands, it is imperative that you create some basic aliases to make your life a bit easier. One way of doing this is to just issue the command, “alias=command.” The problem with this method is that it only keeps the alias until the system is logged off, then you have to enter it all over again.
    The solution? Enter the alias in the .bashrc file. This simple tutorial will explain to you how to do this.


Step one:
Log into Linux and open a terminal.

Step two:
In the terminal, type “leafpad .bashrc”.

Step three:

Hit Enter. A text file (.bashrc) should open in the leafpad text editor.


Scroll down until you reach a line filled with #alias examples.


Step four:

Place your select cursor at the end of the last #alias example and hit enter, making a new line. See photo below.

Step five:

Type the alias in the specified above location using the following format:
alias [shortcut]='[command]'
Replace [shortcut] with the alias you want, and replace [command] with the command that the alias stands for.
Example: alias updatesys='apt-get update && apt-get upgrade'

"The above example is a alias that I use so I can easily update Kali without having to type in “apt-get update && apt-get upgrade” every time."


Picture example:

Final step:

You’re almost there! Now that you’re done typing the alias in, you need to save the .bashrc file. Do this quickly by hitting Ctrl+S or click “File > Save.”

Tip:
To insure that the file has been completely saved, make sure that the asterisk next to the file name is gone:

Tip 1
"Now close the .bashrc file and the terminal behind it. Open a new terminal and try out your alias. If all went according to plan, the alias will be permanent, and can only be removed if you remove it from the .bashrc file in the same way you created it."


Congrats! You’re done! 

Repeat these steps to create as many permanent aliases as you please!





For Latest tricks go Click on 

Comments

Popular Posts