linux的命令别名

2023-12-15 14:46:23 2047

命令别名

对于经常执行的较长的命令,可以将其定义成较短的别名,以方便执行

alias 显示当前shell进程所有可用的命令别名

[16:19:19 root@centos-7 ~]#alias

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 which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

范例:

alias ll='ls -l --color=auto'

注意:在命令行中定义的别名,仅对当前shell进程有效 如果想永久有效,要定义在配置文件中 仅对当前用户:~/.bashrc 对所有用户有效:/etc/bashrc

编辑配置给出的新配置不会立即生效,bash进程重新读取配置文件

source /etc/bashrc

 

 


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: