Home > Article > Operation and Maintenance > Introduction to the usage of alias command under Linux
This article brings you an introduction to the usage of the alias command under Linux. It has 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 command like ssh -i ~/.ssh/138.pem ec2-user@192.168.21.138, our operation and maintenance staff complained about it. After a while, I was given this command
alias 138ssh= 'ssh -i ~/.ssh/138.pem ec2-user@192.168.21.138'
Now 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-pDelete an alias unalias command
Then I happily used the short command and no longer had to remember the IP address of the server.
Hurry up and ask the operation and maintenance brother, and then tell me that alias needs to be reset every time it is restarted
???Then how can I play with it
Fortunately, the operation and maintenance brother taught me another trick
Finally execute the short command of source /etc/bash.bashrc command alias setting and it can be used again
Note: source Filname is in the current bash environment Read and execute the command in FileNameThe above is the detailed content of Introduction to the usage of alias command under Linux. For more information, please follow other related articles on the PHP Chinese website!