In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to set command aliases in the linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
Usage: alias [- p] [name [= value].] Note that there can be no spaces between'= 'and the string.
Displays the alias for the current setting:
Shell > alias-p
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'
Or enter directly:
Shell > alias-p
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'
To show only what an alias represents, type alias name, such as:
Shell > alias ll
Alias ll='ls-l-color=tty'
To set an alias for a command, enter the new alias command = 'original command options / parameters', such as:
Shell > alias site='cd / var/www/site/mycitsm/'
To cancel an alias, type unalias name, such as
Shell > unalias site
However, there is a problem with the above setting method, that is, the command alias set is valid only for the current call, and the alias set before it is disconnected and reconnected is no longer valid.
You can make the alias permanent by writing the command to set the alias in the startup file. Most Linux distributions use one of three startup files:
$HOME/.bash_profile
$HOME/.bash_login
$HOME/.profile
The command to set the alias can be written into the startup file so that the alias takes effect every time you connect to the system. If you want to take effect immediately after the command is written to the startup file, remember to execute the source command, such as:
Source $HOME/.bash_profile
Setting the command alias in the above way solves the problem that the command alias takes effect only for the reply, but the command alias written to the startup file under each user's specific home directory is valid only for that user. It has no effect on other users, which is usually what you would normally expect to see. But if you do want to make the alias valid for any user, you can write the command to set the alias into the global startup file, such as / etc/profile.
After reading the above, do you have any further understanding of how to set command aliases in the linux system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.