Configure an Alias in Linux

In ‘Configure an Alias in Linux’ the IT Pro Challenge virtual lab instructs learners on the use of aliases to increase productivity when using Linux. The use of an alias makes it easier to use common commands that an admin uses multiple times. An alias can turn a long command with several options into a single letter if desired. Each user can also ...

45 minutes
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »


Lab Overview:

In this lab you are a Linux administrator. While using the command prompt there are a number of entries that are repetitive. An administrator can increase their efficiency by assigning aliases that are used instead of the actual commands, options or file paths. Oftentimes aliases can shorten the command using abbreviations or even a single letter.

Compare root user and standard user alias defaults in CentOS 7:

This section introduces the .bashrc file where aliases are stored. The ‘.’ before the filename means that it is a hidden file. This is usually used when the file should only be altered by experienced users. The learner compares the .bashrc file of the user and root to learn an example of aliases.

Manage the -i option aliases for user01:

The tasks in this section challenge the learner to add aliases to the user01 that perform the same functionality as those that the root account had. While performing these tasks basic terminal skills will be learned such as changing users, editing files and formatting the alias entries properly.

Configure aliases for common commands:

This section prompts the learner to once again practice their new ability to create aliases. This section in particular shows their true power as single letters replace entire words. This really speeds things up. Other major topics covered include common commands that are used in the day to day operations of any linux administrator such as getting the date and time and memory usage of a server( hint: when using commands to get memory usage you can use the -h for human readable format).

Remove an alias:

This final section shows the learner how to remove the aliases that they have created. The main concept to remember is that changes can either be made on permanent or temporary basis( command prompt for temporary changes, while editing the .bashrc file for permanent).This is not only true for aliases but many functions in Linux.

Lab Summary Conclusion:

Using an alias for a common command saves time especially when you have to use that command several times a day. Aliases can be either temporary or permanent depending on your needs. Don’t forget that permanent changes require a restart to take effect. When creating an alias think about what repetitive tasks you perform daily. Are there options or file paths that are used all the time? These are perfect candidates for an alias.