如何覆盖.bash_aliases中设置的别名 [英] how can I override alias set in .bash_aliases
本文介绍了如何覆盖.bash_aliases中设置的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢使用bash别名来自定义bash命令.有什么方法可以覆盖bash别名设置,还是应该将别名重命名为与原始命令不同的名称.
I like to use bash aliases to customize bash commands. Is there a way to override the bash alias settings, or should I rename the aliases to something different than the original command.
例如:我的.bash_aliases包含
eg: my .bash_aliases includes
alias ls='ls -ltr'
如果我只想检索文件名,是否需要将别名重命名为'ls'以外的名称?还是有另一种方法?
If I want to only retrieve the file name, do I need to rename the alias to something other than 'ls'? Or is there another way?
推荐答案
在命令前添加\
(反斜杠)以禁用别名,如下所示:
Add a \
(backslash) before the command to disable the alias, like this:
\ls
这将调用原始的(未锯齿的)ls
.
This will invoke the original (un-aliased) ls
.
示例:
$ ls #will invoke the alias
total 0
-rw-rw-r-- 1 dogbane foo 0 Nov 3 16:04 c
-rw-rw-r-- 1 dogbane foo 0 Nov 3 16:04 b
-rw-rw-r-- 1 dogbane foo 0 Nov 3 16:04 a
$ \ls #will disable the alias
a b c
这篇关于如何覆盖.bash_aliases中设置的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文