如何覆盖 .bash_aliases 中设置的别名
我喜欢使用 bash 别名来自定义 bash 命令。有没有办法覆盖 bash 别名设置,或者我应该将别名重命名为与原始命令不同的名称。
例如:我的 .bash_aliases 包含
alias ls='ls -ltr'
如果我只想检索文件名,是否需要将别名重命名为“ls”以外的名称?或者还有别的办法吗?
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.
eg: my .bash_aliases includes
alias ls='ls -ltr'
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在命令前添加
\
(反斜杠)以禁用别名,如下所示:\ls
这将调用原始(未使用别名)
ls
。示例:
Add a
\
(backslash) before the command to disable the alias, like this:\ls
This will invoke the original (un-aliased)
ls
.Example:
您可以暂时使用
/bin/ls
,或`which ls`
you can use
/bin/ls
temporarily, or`which ls`