The alias (Chinese called "Alias") allows you to redefine the Shell command in Linux with a shorter name, simplifying the command line input. If you often deal with the CLI, using the alias will not only save time but also improve efficiency, and it is a good thing to kill the birds. Basic usage: The basic use of alias is: alias new command = ' original command-option/parameter '. For example, alias l= ' Ls-lsh ' will redefine the LS command, and now you can just type L to list the directory. Learn aliases: direct input to the alias command lists all the command aliases that are already defined in the current system. Remove alias: To remove an alias, you can use the Unalias command, such as Unalias L.
The above is seen on the Internet, this method is only temporary, if the restart is invalidated, if we want to permanently effective an order how to do it?
Open. BASHRC (should be an Ubuntu release, and other distributions may be modified. Bash_profile) you can see
......
# some more LS aliases
Alias Ll= ' Ls-alf '
Alias La= ' Ls-a '
Alias l= ' LS-CF '
......
Method 1: Add alias xx= ' xxxxx ' directly to our environment variable file
Method 2: There is a word in BASHRC.
# you could want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
That means you can create a new file to store your own alias information.
Cases
$ cd
$ vi. bash_aliases
Enter the command you want to set in the file alias rm= ' Rm-i ' and save the launch
$ source. BASHRC #让我们的环境生效
Method......
Summary:
1. Most of the time we only pay attention to solve the problem itself, but often ignore other things, in the process of solving the problem is also a learning opportunity, especially do not forget to look at the software source and so on comments. Suddenly found this is very important, because I read the annotation, I found this method, and my original purpose is to make changes to my own environment variables, in solving the problem of environmental variables at the same time I have to solve the problem of the alias, I have to remember ...
2. When looking for solutions on the Internet, it is often found that other people have files that are not native, for example. BASHRC and. Bash_profile may be on different distributions, this time you can change the search method, or try it yourself ...