Aliases

Using aliases within the shell can greatly improve your efficiency, especially if you are new to UNIX. Aliases enable you to assign an alternate name to a command or a combination of commands. You’ll use aliases to personalize your environment.

Aliases are not supported in the Bourne shell, but here is how they are set in the Korn shell. Defining an alias is much like setting a variable. The syntax for setting an alias using the alias command is as follows:

alias aliasname=value
					

For example, to create an alias named del that will be the equivalent of typing the rm command, type the following:

alias del=rm 

If you use any whitespace in your value, make sure you use quotes as follows:

alias del='rm –i' 

To list all of your aliases, type the following:

alias <cr> 

A list of all defined aliases will be displayed.

Place the aliases in your $HOME/.profile or $HOME/.kshrc file so that they get set automatically every time you log in.

Note

When using CDE, you’ll notice that your aliases don’t get set when you place them into your $HOME/.profile. Here’s what you need to do.

Enter the following lines in your $HOME/.profile:

set –ha 
ENV=$HOME/.kshrc; export ENV 

This will enable you to use an environment file named .kshrc, which, unlike the .profile, gets run every time you open a new K shell. It’s used specifically for setting environmental options in the shell. Define your aliases in the $HOME/.kshrc file.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset