Adding aliases, and altering user paths/variables
In this recipe, we are going to create an alias of a command and alter the user path variable. We are going to learn about the alias command. Using alias command, we are going to create aliases for other commands.
Getting ready
Besides having a terminal open, we need the basic knowledge of the alias command.
How to do it...
- We will create a alias for the
pwdcommand. Run this command:
$ alias p=pwd- Now, we will create an alias for the
lscommand. Run the following command:
$ alias l=”ls -l”How it works...
The alias command is used to create a shortcut for commonly used commands.
- We have created an alias
pfor commandpwd. So, we just run thepcommand to get the present working directory. - We have created an alias
lfor commandls. So, we just run thelcommand to get the list.
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime