Linux alias command - how to create and use Linux aliases

Aliases in Unix and Linux operating systems are cool. They let you define your own commands, or command shortcuts, so you can customize the command line  But before we start, we need to reveal a small command line trick. It's possible to put more than one command on a line by separating each command with a semicolon character. It  work  like  this



Here's the  example we  will use


We  have combine   two  commads.
First   we  change /root  Directory  to  Desktop  and  the  return  back  to  /root  Directory using
( cd -).

The first thing we have to do is dream up a name for our new
command. Let's try “web”. Before we do that, it would be a good idea to find out if the name “test” is already being used. To find out, we can use the type command again:


Great! “web” is not taken. So let's create our alias:



Notice the structure of this command:

alias name='string'


we have  used  /var/www/  directory.  /www    part  of apache server  directory where  we  upload  .html, .php etc.. files .   Second    Command  we  have used  ls -l   this command  show the  list of  directory with  details.

After the command “alias” we give alias a name followed immediately (no whitespace allowed) by an equals sign, followed immediately by a quoted string containing the meaning to be assigned to the name. After we define our alias, it can be used anywhere the shell would expect a command. Let's try it:


Great!  Directories  Change  and  show  list.

We can also use the type command again to see our alias:

To remove an alias, the unalias command is used, like so:



Wooo  Great!........

hope it  will  helpfull  for  you !