Showing posts with label alias. Show all posts
Showing posts with label alias. Show all posts

Monday, 22 August 2016

How to Create alias in windows and unix operating system

This article shows how to create a alias in both windows and Unix command prompt.

1. Windows:

1. Open the command prompt. ( Run -> type "cmd" and hit enter.

2. use the below command to create an alias.
            doskey <alias>=<command>

For ex : if i want to set alias sys to connect the database i use the below command.
* doskey sys=sqlplus system/oracle

Now if you type sys it will directly connect to the database by running the sqlplus command.


UNIX:
Now we will see how to create alias in Unix operating system.

1. Login to bash shell.

2. Below is the command used to create an alias in UNIX.

* alias <alias_name>=<command>

For ex : if i want to set l to run the command ls -lrt use the below command.

alias l="ls -lrt"

When you type l it will run the command you have set for this alias.

MBP:~ nirmalg$ alias l="ls -lrt"
MBP:~ nirmalg$ l
total 0
drwxr-xr-x+  4 user1  staff   128 Mar 29 16:37 Public
drwx------+  5 user1  staff   160 Apr  9 22:01 Pictures
drwxr-xr-x   6 user1  staff   192 Apr 24 06:57 Applications

MBP:~ nirmalg$