Linux command alias alias usage

Command alias: alias
alias displays all aliases defined in the current shell
[root@zabbix_agentd zabbix]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep = 'grep --color = auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls = 'ls --color = auto'
alias mv='mv -i'
alias rm = 'rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@zabbix_agentd zabbix]#
The alias of the command is defined in alias. As shown above, when cp is used, cp -i is actually used. If the alias is not applicable, add a backslash \cp before the command.
define alias
alias Alias="original command" In the original command, if there is no parameter, no space is required'
as follows:
Define the clear alias of the clear screen command as cls
[root@zabbix_agentd zabbix]# alias cls=clear
After definition, clear can be executed using cls
[root@zabbix_agentd zabbix]# alias
alias cls='clear'
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep = 'grep --color = auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls = 'ls --color = auto'
alias mv='mv -i'
alias rm = 'rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
free alias: unalias
[root@zabbix_agentd zabbix]# unalias cls
[root@zabbix_agentd zabbix]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep = 'grep --color = auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls = 'ls --color = auto'
alias mv='mv -i'
alias rm = 'rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@zabbix_agentd zabbix]#


http://www.111cn.net/sys/linux/118456.htm

After defining the alias command, if Error:TERM environment variable not set appears, add these two sentences before executing the script
TERM=linux
export TERM


http://blog.chinaunix.net/uid-1886735-id-2810702.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269180&siteId=291194637