Linux Command alias, unalias, aliasunalias

Source: Internet
Author: User

Linux Command alias, unalias, aliasunalias
1. Alias
Linux alias: 1. Simplified special long commands and parameters 2. Added default options for some commands to improve security.
2. Use alias

[www@work sh]$ alias lm='ls -l | more'[www@work sh]$ 
The lm command will be added and the ls-l | more command will be executed. Add the-I parameter to the rm command to prevent accidental file deletion.
$ alias rm='rm -i'
View All aliases
www@work sh]$ aliasalias ll='ls -l --color=tty'alias lm='ls -l | more'alias ls='ls --color=tty'alias rm='rm -i'alias vi='vim'alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'[www@work sh]$ 
Exiting the current session will expire. To save permanently, you can write ~ /. Bashrc.
3. Cancel alias unalias
Remove the alias and use unalias.
[www@work sh]$ unalias lm

Address: http://blog.csdn.net/yonggang7/article/details/40709395

The new linux class has a command: alias

Alias unalias is an internal bash command.

First, the system itself has the dir command (not an alias). When you set the ls alias to dir, the system will first call ls instead of dir, unalias, resume calling the original dir command, while the output of the dir command is not stained.

Second, similarly, mkdir is not an alias but does have its command. You can use which mkdir to query

If you do not know whether a command is an alias or actually exists, use the which command to check whether the command exists.

How does one delete a command alias in linux?

Use unalias to add an alias and delete it directly
Syntax: unalias [-a] [alias]
Parameter-a indicates deleting all aliases. Be careful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.