1. Use of alias The alias command is used to set an alias for a command. We can use this command to simplify some longer commands. Use alias short command = 'original command option' alias 138ssh= 'ssh -i ~/.ssh/138.pem ec2-user@192.168.21.138' Now you can directly use 138ssh instead of the original ssh -i ~/.ssh/138.pem ec2-user@192.168.21.138 View all current aliases alias-p Remove an alias unalias command Then I happily used the short command and no longer had to remember the server's IP address. 2. Alias persistence The next day when I was at work and happily typing out my short command, I found I quickly ran to ask the operation and maintenance brother, and then he told me that alias needs to be reset every time it is restarted. How can we play this? Fortunately, the operation and maintenance brother taught me another trick Add the alias command to /etc/.bashrc or ~/.bashrc file so you don't have to reset it every time you restart. /etc/.bashrc is effective for all users, ~/.bashrc is effective for the current user 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 the commands in FileName in the current bash environment You may also be interested in:
|
<<: Solve the Chinese garbled problem of mysql5.5 database command line under Windows 10
>>: React diff algorithm source code analysis
When we work in a terminal or console, we may not...
1: Define a stored procedure to separate strings ...
Table of contents need: drive: Ideas: accomplish:...
Introduction As mentioned in the previous article...
Zabbix server environment platform ZABBIX version...
Table of contents Overview computed watch monitor...
hint This plug-in can only be accessed under the ...
The execution efficiency of MySQL database has a ...
What is MySQL multi-instance Simply put, MySQL mu...
Recently, when I was modifying the intranet porta...
Recommended reading: Navicat12.1 series cracking ...
Table of contents In the React official website, ...
Preface It's a cliché. Here I will talk about...
<br />Green is between yellow and blue (cold...
Since Alibaba Cloud's import of custom Ubuntu...