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 [email protected]' Now you can directly use 138ssh instead of the original ssh -i ~/.ssh/138.pem [email protected] 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
Table of contents Linux MySQL 5.5 upgraded to MyS...
1. Download mysql-8.0.17-winx64 from the official...
What are :is and :where? :is() and :where() are p...
1. Business scenario introduction Suppose there i...
Using the image service deployed by docker stack,...
Docker virtualizes a bridge on the host machine. ...
Table of contents Preface Do not use strings to s...
Table of contents 1. Overview 1.1 What is a proto...
Table of contents What are Refs 1. String type Re...
Preface Managing routing is an essential feature ...
Preface This article mainly introduces the releva...
Anyone who has a little knowledge of data operati...
Table of contents Preface text 1. Global Registra...
Create a mysql user and authorize: Format: grant ...
Table of contents 01 Introduction to Atomic DDL 0...