Log in Go to the main page Page Discussion History Go to the file list Go to the site toolbox Bookmark and Share

Alias command, Linux

From RZWiki

Image:linux-logo-large.png

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

Image:Vm-power-on-medium.png Usage Syntax

alias [name[=value]]

Image:Vm-power-on-medium.png 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

Image:accessories-text-editor-v2-medium.png 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.

Image:accessories-text-editor-v2-medium.png 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

Image:utilities-terminal-medium-v2.png 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'

Image:icemon-medium.png 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.

Image:object-flip-horizontal-medium.png Command Equivalents

The Cisco command equivalent has the same name: alias command, Cisco Image:Cisco-logo-small.png

Image:icemon-medium.png Related Articles

Information on other Linux commands Image:linux-logo-small.png

Information on F5 BigIP commands Image:F5-logo-small.png

Information on Cisco commands Image:Cisco-logo-small.png

Information on Vyatta commands Image:Vyatta-logo-small.png

Information on Extreme commands Image:Extreme-logo-small.png

Information on Zebra commands

Information on Secure Platform commands

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Image:internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to sjiveson#routerzone.eu
(replacing the # with an @)


Site Toolbox:

Personal tools
This page was last modified on 28 February 2010, at 17:07. - This page has been accessed 14 times. - Disclaimers - About RZWiki
Powered by MediaWiki