First, the environment
CentOS6.8
Second, set the alias
Alias feature: Highlight the keyword that grep matches
1. Temporary entry into force
[[Email protected] ~] #alias grep= "grep--color=auto"
[[Email protected] ~] #alias//check
2. Permanent entry into force
Method one edit/etc/profile "Effective for all users (permanent)"
[[Email protected] ~] #echo "Alias grep= ' grep--color=auto '" >>/etc/profile
[[Email protected] ~] #tail-1/etc/profile
[[Email protected] ~] #source/etc/profile
Method two edit/ETC/.BASHRC "only valid for the currently logged on user (permanent)"
[[Email protected] ~] #echo "Alias grep= ' grep--color=auto '" >>/.BASHRC
[[Email protected] ~] #tail-1. BASHRC
[[Email protected] ~] #source. BASHRC
Third, the default setting alias brings problems
When a file from the CP or MV in a directory is under another directory, if a file with the same name as the moving file is present in the directory, the user will be prompted to overwrite the file, as the CentOS system has previously configured some command aliases (1-1). If you copy or move files under one directory to another directory, there is a large number of file names that need to be overwritten, which makes the CP or MV command operation extremely cumbersome (1-2).
Figure 1-1
Figure 1-2
Four, the method of blocking aliases
1. Absolute path to command when executing commands
2. "\" symbol in front of the command
CentOS Setup aliases and masking aliases for Linux