bash 我如何找到可执行文件在 macosx 中的位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3404096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how do I find where a executable is present in macosx?
提问by Deepan Chakravarthy
I have a command called youtube-dl .. but dont know where it is installed.. i can run it from shell.. how do i find where it is installed ? which youtube-dl doesnt say anything..
我有一个名为 youtube-dl 的命令 .. 但不知道它安装在哪里.. 我可以从 shell 运行它.. 我如何找到它的安装位置?哪个 youtube-dl 什么也没说..
回答by Paused until further notice.
Bash has a command that will show whether a command is an alias, a function or an executable in your path (and, if so, where):
Bash 有一个命令,可以显示命令是路径中的别名、函数还是可执行文件(如果是,则显示在何处):
type -a youtube-dl
It's much better than which
.
它比which
.
回答by Nordic Mainframe
If you can't find it with which
(or whereis
) then it could be:
如果您无法使用which
(或whereis
)找到它,那么它可能是:
- a function defined in .bashrc or .profile (or some other file the shell loads on startup or login)
- an alias defined in one of the above files.
- 在 .bashrc 或 .profile 中定义的函数(或 shell 在启动或登录时加载的其他一些文件)
- 在上述文件之一中定义的别名。
You can search your environment for youtube-dl:
您可以在您的环境中搜索 youtube-dl:
$ set | grep youtube-dl
or save it to some file and load it into a texteditor:
或将其保存到某个文件并将其加载到文本编辑器中:
$ set >myenv
$ open -a textedit myenv
and for the aliases:
和别名:
$ alias >myalias
or
或者
$ alias | grep youtube-dl
回答by Felix Kling
Have you tried
你有没有尝试过
whereis youtube-dl
?
?
Otherwise you could just search for it:
否则你可以只搜索它:
find / -name youtube-dl