alias (Unix)
An alias is a function of a Unix shell with which several Unix commands or a Unix command with several options can be replaced by a new command. It is used to save time and type less.
The alias could be an example of a combination of the Unix commands ps
and grep
the Bash shell psg
. The aim of the new command psg
is to output a specific process on the screen. In the following example information should about the daemon by syslog output. By calling the Unix shell command alias
, all known aliases are displayed in the terminal . The function is unalias
used if the new command is to be deleted again .
$ alias psg='ps -ax | grep -v grep | grep'
$ psg syslog
35 ?? Ss 0:00.26 /usr/sbin/syslogd
$ alias
alias psg='ps -ax | grep -v grep | grep'
$ unalias psg
The defined aliases can be saved in the start files of the user profile .
Often aliases are used with the Unix command ls
. A popular example is l
or ll
, an alias for ls -l
, which shows more detailed output showing the permissions for all files in a particular directory. However, on HP-UX , this command is a binary file .
Web links
-
alias
: define or display aliases - Open Group Base Specification -
alias(P)
: Define or display aliases - Debian GNU / Linux POSIX Programmer's Manual Guide Page - Alias as a Bash input help
-
builtin(1)
: shell built-in commands - FreeBSD General Commands Manual