有人能告诉我别名ll的终端命令是什么吗?我在网上所能找到的就是很多人说它是ls -l、ls -la或ls -ltr的别名。但这完全是错误的。结果看起来不一样。有任何方法来定位ll并查看其语法吗?
发布于 2018-05-10 04:24:58
您可以查看~/..bashrc(或别名所在的某个文件),也可以在shell中编写以下命令:
command -v ll # "command" is a shell built-in that display information about
# the command. Use the built-in "help command" to see the
# options.
type -p ll # "type" is another built-in that display information about how the
# command would be interpreted
grep -r "alias ll=" ~ # and don't worry about de .file that contains your
# alias. This command search recursively under each
# folder of your home. So it's something rude.
find ~ -maxdepth 1 -type f | xargs grep "alias ll" # Just look in
# the files (not folders) in your home folder但是为什么在没有-name ".*“的情况下使用find?因为你可以把这个放在你的.bashrc里
source bash_hacks # where the file bash_hacks, in your home directory can
# contain the alias ll='ls -la etc etc'.因为"ll“是一个别名,没有必要只有一个意思(ll='ls -alF -color‘),所以您可以将您的"ll”命名为另一个comand,我不知道,"rm“。我认为这更像是一种惯例(通用产品)。
但是"ll“可以是存储在路径的任意文件夹中的程序。例如,如果您在家里有一个名为"bin“的文件夹,请创建一个"ll”脚本,其中包含以下内容
#!/bin/bash
ls -lhar但是,如果您的路径被更改为添加另一个包含新的"ll“命令的文件夹,怎么办?要获得更多有趣的信息,您可以参考以下链接到相关的问题。
发布于 2018-05-16 00:42:16
不需要解析~/..bashrc或任何其他脚本。您可以检查在终端中键入alias命令的所有别名的当前值。它将把所有定义的别名及其定义带到您的屏幕上。
发布于 2019-09-30 19:59:13
应该是ls -la。见Linuxize.com:https://linuxize.com/post/how-to-create-bash-aliases/
https://askubuntu.com/questions/1033998
复制相似问题