Quantcast
Viewing all articles
Browse latest Browse all 14

Learning Linux Commands: alias

Introduction

The alias command is a handy tool to have if you often work on the command line. If set correctly it will help you to type your commands faster as well as it will even help you to correct your typos. alias is a shell builtin command, which means that no installation is required as it is available on your system by default. This tutorial will teach you how to use the alias command in the Linux operating system by explaining the alias command in more detail with use of examples.

What is the alias command in Linux?

alias is used to create alternative versions of your regular commands by giving them new names. It is also used to create new simpler to remember commands from obscure and long commands. With alias you can also set default options to be used every time you execute the alias command.

How to create alias in Linux

How many times it happened to you that instead of ls command you have typed sl? And end up with error:

$ sl
-bash: sl: command not found

Let's use the above, to show you an example on how to create alias in Linux and to avoid the above error message. To create alias use alias command with the following syntax:

alias alias_command_name='commands'

Therefore, we can create a new alias called "sl", which will be an alternative command to ls command.


Viewing all articles
Browse latest Browse all 14

Trending Articles