Linux Learning Note--which command (command to search for commands)

Source: Internet
Author: User

Which, which means, is to search for the location of the command and the command alias from the path specified by the PATH environment variable.

which command features:

1"which" 命令只能查找系统命令,不能搜索普通文件。2"which" 命令是从PATH环境变量指定的路径中,搜索某个系统命令的位置,    并且返回第一个搜索结果。

PATH environment variable:

PATH:决定了shell将到哪些目录中寻找命令或程序,PATH的值是一系列目录,用":"隔开,当您运行一个命令时,Linux在这些目录下进行搜寻编译链接。

The which command differs from the Whereis command:

1"whereis" 命令查询的是命令位置和帮助文档的位置;   "which" 命令查询的是命令位置和命令别名。2"whereis" 命令是从数据库中查找数据,数据库不是实时更新的;   "which" 命令是从PATH环境变量指定的路径中查询命令,是实时的。

1. Command format:

which 命令名

2. Common examples:

1) 查看"ll"命令所在位置和别名

Linux Learning Note--which command (command to search for commands)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.