Alias command, Linux
From RZWiki
A CLI command shell built-in function available on Linux platforms; used to create, modify or display command aliases.
A command alias is a user-assigned string that is associated (or 'mapped') to a full command name and any required options or parameters. This string is then entered at the CLI instead of the (normally longer) full command name and any required options or parameters, thus saving keystrokes, time and possibly having to remember complex command syntax.
Contents |
Usage Syntax
alias [name[=value]]
Usage Examples
alias - display all configured aliases
alias ll - display the alias ll
alias delete=rm - create an alias of of the rm command called delete
Usage Notes
To modify an existing alias, use the same syntax as when creating a new one.
Use the unalias command to remove command aliases.
font color=redAliases created by this command will not persist after the system is restarted./font To configure permanent aliases add them to the ~/.bashrc file under the '#Alias definitions' stanza or alternatively create the file /.bash_aliases, add them to that (in both cases using the syntax detailed above) and uncomment these lines in ~/.bashrc;
#if [ -f ~/.bash_aliases ]; then # . ~/.bash_aliases #fi
Changes will not take effect until you exit and restart your shell/terminal.
Aliases are user specific.
Command aliases can also be used to provide assistance to those unfamiliar with the commands of a particular operating system through the creation of aliases that 'map' the known environment command names to the actual environment's commands. For instance, a Cisco user unfamiliar with Linux commands could use an alias of show interfaces that executes the Linux command ifconfig.
Linux Usage Notes
With most Linux or Unix commands;
- Non root users may need to prefix commands with the sudo command, for example: sudo chmod 644 *
- Brief help can be displayed using the -h or --help parameter, for example: chmod --help
- A full command manual can be displayed using the man command followed by the command name, for example: man chmod
- Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
- Version information can normally be display using the -v, -V or --version parameter, for example: chmod --version. However, this paramater is also frequently used to display verbose output.
noinclude/noinclude
Typical Output
noinclude/noinclude
alias;
alias l.='ls -d .* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias vi='vim' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
Related Commands
Use the unalias command to remove command aliases created with this command.
To remove permanent command aliases, remove them from either the ~/.bashrc or /.bash_aliases files, depending on which is used.
Command Equivalents
The Cisco command equivalent has the same name: alias command, Cisco
Related Articles
Information on other Linux commands
Information on F5 BigIP commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on Zebra commands
Information on Secure Platform commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands
(replacing the # with an @) |







