In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the alias command under Linux. I hope you will gain a lot after reading this article. Let's discuss it together.
The content of this article is about the introduction of the usage of alias command under Linux. It has a certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Recently, when I used ssh to connect to a remote machine and typed a long list of commands such as ssh-I ~ /. Ssh/138.pem ec2-user@192.168.21.138, our operation and maintenance staff complained about it for a while, so they gave me this command.
The use of 1.alias
The alias command is used to set the alias of the instruction. We can use this command to simplify some longer commands.
Use the alias short command = 'original command option'
Alias 138ssh = 'ssh-I ~ / .ssh/138.pem ec2-user@192.168.21.138'
Then you can directly use 138ssh to replace the original ssh-I ~ /. Ssh/138.pem ec2-user@192.168.21.138
View all current alias alias-p
Delete an alias unalias command
Then I happily used the short command so that I no longer had to remember the ip address of the server.
Persistence of 2.alias
The next day, when I was at work, I happily typed out my short order and found that
Run quickly to ask the operation and maintenance brother, and then tell me that alias needs to be reset every time it restarts.
??? Then how can we play?
Luckily, the operation and maintenance brother taught me another trick.
Add the alias command to the / etc/.bashrc or ~ / .bashrc file so that you don't have to reset every restart
/ etc/.bashrc is valid for all users, and ~ / .bashrc is valid for current users
Ps: my system is deep linux modified / etc/bash.bashrc
Finally, execute the source / etc/bash.bashrc command and the short command set by alias can be used again.
Note: source Filname reads and executes commands in FileName in the current bash environment
After reading this article, I believe you have a certain understanding of how to use the alias command under Linux. You want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!
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.