Aliases can be used to perform complex commands but are set in the shell like environmental variables.
If you find yourself frequently using a fairly complicated command like the one below and want to be able to run it without typing the whole thing you can use the
alias command to set up a shortcut.
$ alias alert=â€™tail -200 /u01/installed/software/mypgm/alert.log|moreâ€™
Now you can execute this whole command simply by typing
alert. Many of the features of shell scripting are available in aliases including the pipe (|) used to send the output of one command to the input of another.
If you would like to have an alias automatically set up every time you enter a shell you can add the alias definition to your
.profile file (or whatever file your default shell executes at login.)
A small set of well written aliases can save you a lot of keystrokes, just be careful not to make aliases with the same name as commands you use unless you want the alias to replace that command when you type it.