Use the which and Whereis commands in Linux to locate and locate files

Source: Internet
Author: User

which

Find a file in an environment variable

-A finds all content, not the first file

-n < filename length > Specifies a filename length that must be greater than or equal to the longest file name in all files.

-p < filename length > is the same as-n parameter, but here < filename length > includes the path to the file.

-W Specifies the width of the field when output.

-V Displays version information.

Cases:

The code is as follows:

[Zhangy@blackghost download]$ which find

/usr/bin/find

Whereis

Syntax of the Whereis command: Whereis [-BMSU] [BMS directory name-f] File name

The options for the Whereis command have the following meanings:

-B locates the executable file.

-M locate Help file.

-S locates the source code file.

-U searches for files other than executables, source code files, and Help files under the default path.

-b Specifies the path to search for an executable file.

-m specifies the path to the search Help file.

-s specifies the path to the search source code file.

Cases:

The code is as follows:

[Root@localhost ~]# Whereis Nginx

Nginx:/usr/sbin/nginx/etc/nginx/usr/share/nginx/usr/share/man/man3/nginx.3pm.gz

Related Article

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.