November 2015
Beginner
282 pages
5h 5m
English
Alias in shell refers to giving another name to a command or group of commands. It is very useful when a name of a command is long. With the help of alias, we can avoid typing a bigger name and invoke a command by a name as per your convenience.
To create an alias, alias shell builtin command is used. The syntax is as follows:
alias alias_name="Commands to be aliased"
To print a disk space in a human-readable format, we use the df command with the -h option. By making alias of df -h to df, we can avoid typing again and again df -h.
The output of the df command before aliasing it to df -h is shown in the following screenshot:
$ df
Now, to create alias for df -h to df, we will execute the following command:
$ alias df="df -h" # ...Read now
Unlock full access