Working with Aliases

Aliases or macros can be quite useful as they provide a way of specifying a small alternative name to a big command line. You can specify an alias for another command, a file path, a directory path or any string of text. If you have to do some tasks quite often then aliases can be of great help.

Checking Current System Date

We have already seen how to use command substitution and display current system date and time. Now we are going to create an alias for checking current system date and time. Just copy and paste the following line and press enter to create an alias with the name $sysdate.

alias $sysdate echohtml Current system date is <font style="color:red"><b>+|date|</b>.</font>

After creating the alias just type "$sysdate" (without quotes) and press enter. This will show you the current system date with an output formatted using html tags. So next time when you want to check the current system date, you can simply type $sysdate instead of the big command line. Aliases are not case sensitive.

current system date alias

To escape the alias name you can use the Null Placeholder Operator (NPO) as shown in the image above. Check out an another tutorial for creating alias : Command substitution with aliases.