The alias command is used in Linux to create a shortcut (alias) to any command and options. Aliases are usually used to assign easier-to-remember names to some commands, to implement desirable command options as the default for commands or to create a shortened version of a command to minimize the amount of typing.
You can add and list aliases using the alias command. The syntax is:
For example, if you are coming from the Windows world, you might be used to type dir to display the list of files and directories in the current directory. You can create an alias named dir that will execute the ls -l command:
You can define an alias that executes more than one command:
In the example above you can see that dir executes the ls -l and pwd commands.
You can also use the alias command to change the default behavior of the existing commands. For example, if you want the ls command to always display a file list using the long listing format, you can specify an alias that will execute the -l option by default:
To print the current values, type alias without any options:
To remove an alias, type unalias NAME: