Linux: alias takes effect permanently
Alias allows you to use a shorter name to redefine Shell commands in Linux, thus simplifying command line input.
If you often deal with the CLI, using alias will not only save time, but also improve efficiency.
Basic usage: the basic usage of alias is: alias new command = 'original command-option/parameter '. For example, alias l = 'LS-lsh' will redefine the ls command. Now you only need to enter l to list directories.
Get the alias: directly enter the alias command to list all the alias defined in the current system.
Delete alias: to delete an alias, you can use the unalias command, such as unalias l.
The above method is only temporary. If it is restarted once, it will become invalid. What if we want to permanently activate a command?
Open. bashrc (it should be the ubuntu release, and other releases may be able to modify. bash_profile ).
......
# Some more ls aliases
Alias ll = 'LS-alf'
Alias la = 'LS-'
Alias l = 'LS-CF'
......
Method 1: Add alias xx = 'xxxxx' directly to our environment variable file'
Method 2: There is a sentence in. bashrc
# You may want to put all your additions into a separate file like
#~ /. Bash_aliases, instead of adding them here directly.
That is to say, you can create another file to store your own alias information.
Example
$ Cd
$ Vi. bash_aliases
Enter the command alias rm = 'rm-I 'you want to set in the file, and then save and launch
$ Source. bashrc # Make Our Environment effective
For example:
Alias ls = 'LS-ltr'
Alias cat = 'nohup $ CAT/start_navicat &'
Alias db = 'mysql-uroot-proot'
......