Linux alias command written

  • 2020-10-31 22:05:32
  • OfStack

Write the alias command

Linux operating system to open some applications, sometimes need to enter the corresponding folder, open the corresponding program, not very convenient. The alias command is a command alias nomenclature that reduces a complex command to a relatively simple and memorable command that we name ourselves. Can be extremely convenient for our operation.

Command operation procedure

The following command needs to be executed at the terminal during the operation.

(1) Edit bash command file.


sudo vim ~/.bashrc   // Edit the corresponding bashrc file 

(2) Add the corresponding alias command at the specific location.


alians xxx='some commom command'

So let's take the example of WeChat

for example:


alias wechat='cd electronic-wechat&&npm start' // Add a command 

(3) Update the bashrc file to make the alias command effective.


. ~/.bashrc  // Update effective related to bashrc file 

Execute the alias command

After step 3, the alias command is in effect, and you can execute the alias command you just wrote.

Open the WeChat

Because previously wrote WeChat alias command:


alias wechat='cd electronic-wechat&&npm start' // Add a command 

Enter the following command directly in the terminal:

wechat

If I hit enter, I'll successfully open WeChat.

conclusion

The process of opening an application can be greatly simplified by writing one alias command for each software open.


Related articles: