Current location - Music Encyclopedia - Chinese History - How to set up automatic saving of aliases?
How to set up automatic saving of aliases?
You can set the automatic saving of aliases according to the following steps:

1. Open the terminal and enter your home directory, such as cd ~

2. Open or create a file named. Bashrc, such as nano.bashrc.

3. Add the following command line to the. Save the bashrc file of the alias command:

```

Alias alias =' command'

Alias aliasname2='command2'

# Save the alias command in. Bashrc file so that it will still be available at the next login.

echo " alias alias name = ' command ' " & gt; & gt~/.bashrc

echo " alias alias name 2 = ' command 2 ' " & gt; & gt~/.bashrc

```

Among them, aliasname and aliasname2 are your customized aliases, and' ‘command 2' and' command2' are corresponding commands or instructions.

4. Press "Ctrl+X" to save and exit. Bashrc file.

5. Run the following command to make the newly added alias command take effect immediately in the current session:

```

Source ~/. bashrc

```

After completing the above steps, the alias command you added will be automatically saved and will still be available at the next login.