Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

day 15 - linux 命令 : which #84

Open
hoperyy opened this issue Oct 12, 2017 · 0 comments
Open

day 15 - linux 命令 : which #84

hoperyy opened this issue Oct 12, 2017 · 0 comments

Comments

@hoperyy
Copy link
Owner

hoperyy commented Oct 12, 2017

day 15 - linux 命令 : which

我们经常在 linux 要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索:

which 查看可执行文件的位置。
whereis 查看文件的位置。
locate 配合数据库查看文件位置。
find 实际搜寻硬盘查询文件名称。

which 命令的作用是,在 PATH 变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就是说,使用 which 命令,就可以看到某个系统命令是否存在,以及执行的到底是哪一个位置的命令。

语法

which 可执行文件

which 指令会在 PATH 变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。

实例

  • 获取安装的第三方全局命令位置

    which node

  • which cd: cd: shell built-in command

@hoperyy hoperyy added Linux and removed Linux labels Oct 12, 2017
@hoperyy hoperyy closed this as completed Apr 29, 2018
@hoperyy hoperyy reopened this May 29, 2018
@hoperyy hoperyy closed this as completed May 29, 2018
@hoperyy hoperyy reopened this May 29, 2018
@hoperyy hoperyy added 工具 and removed 2017 labels May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant