|
In Unix shells (like csh, bash, etc.), alias is a command that enables a replacement of a word with another string. It's mainly used for abbreviating a system command, or for adding default arguments to a command which one regularly uses. For example: A Unix shell, also called the command line, provides the traditional user interface for the Unix operating system. ...
CSH is a three-letter abbreviation with multiple meanings: The United States Army operates combat support hospitals. ...
Bash is a Unix shell written for the GNU Project. ...
alias xx="ls -l" would enable one to type xx to do ls -l. This would last while the current shell was active and would not work in another shell or another session. Regularly used aliases could be placed in the shell's configuration file (~/.cshrc or the systemwide /etc/csh.cshrc for csh, or ~/.bashrc or the systemwide /etc/bashrc for bash) etc., to run them at login or shell startup. For more permanent replacement that is independent of the shell, one might use a symbolic link rather than an alias: In computing, a symbolic link (often shortened to symlink) is a special type of file that serves as a reference to another file. ...
ln -s /usr/bin/fullcommandname /usr/bin/shortercommand Or without root access: ln -s /usr/bin/somecommandlong ~/bin/shortcmd Aliases cannot do more sophisticated stuff like taking arguments, etc. For that, most shells support functions instead. Typical aliases (from bash): alias ls='ls --color=tty' # use colors alias la='ls -a' alias ll='ls -l' alias rm='rm -i' # prompt before overwrite alias cp='cp -i' alias mv='mv -i' alias vi='vim' # use improved vi editor Anonymous Aliases With anonymous aliases it's possible to use a command as it was meant originally defined, even if an alias with extra arguments exists for that command. For instance, if the following alias definition is set alias ls='ls -la' We can still use "ls" as a no extra arguments command. In order to do so, just put the command without arguments as follow: 'ls' |