System environment: RHEL5.31.alias can be used to set the alias of a command, for example, [root @ localhost ~] # Alias // view the default set alias aliascp & amp; #39; cp-I & amp; #39; aliasl. & amp; #39; ls-d. * -- colortty & amp; #39; aliasll & amp; #39; l...
System environment: RHEL5.3
1. alias can set command alias
For example:
[Root @ localhost ~] # Alias // view the default system alias
Alias cp = 'CP-I'
Alias l. = 'ls-d. * -- color = tty'
Alias ll = 'ls-l -- color = tty'
Alias ls = 'ls -- color = tty'
[Root @ localhost ~] # Alias pw = passwd // Set the passwd command
[Root @ localhost ~] # Pw
Changing password for user root.
New UNIX password:
[Root @ localhost ~] # Unalias pw = passwd // undo the alias you just set
However, after this setting, the alias becomes invalid after the system restarts. how can I make the alias take effect after it is restarted?
Method 1:
There is a. bashrc in the user's home directory. use vim to open this file and add the alias you want to set. for example
Alias rm = 'rm-I'
Alias cp = 'CP-I'
Alias mv = 'MV-I'
Method 2:
Method 1 is feasible, but the alias just set does not work when other users log on to the linux host. so we will introduce method 2 here:
Use vim to open the/etc/bashrc directory and add the alias you want.
Alias rm = 'rm-I 'alias cp = 'CP-I'
Alias mv = 'MV-I'
At this time, even if the computer is restarted, or other users can use the alias you just set for logon!
Author: "New network subnet"