Home > Operation and Maintenance > Linux Operation and Maintenance > How to use which command in Linux?

How to use which command in Linux?

Guanhui
Release: 2020-06-28 14:57:23
Original
4275 people have browsed it

The function of which command in Linux is to search for the location of a certain system command in the path specified by the PATH variable and return the first search result. Its usage is "which [file...]" , its parameters include "-n", "-p", "-w" and "-V".

How to use which command in Linux?

Linux which command is used to find files.

which command will search for files that meet the conditions in the directory set by the environment variable $PATH.

which Syntax

which [文件...]
Copy after login

which Parameter

-n Specifies the file name length, specified The length must be greater than or equal to the longest file name of all files.

-p Same as the -n parameter, but the here includes the path of the file.

-w Specifies the width of the field during output.

-V Display version information.

which Example

Use the command "which" to view the absolute path of the command "bash", enter the following command:

$ which bash
Copy after login

After executing the above command , the output information is as follows:

/bin/bash                   #bash可执行程序的绝对路径
Copy after login

Recommended tutorial: "Linux Operation and Maintenance"

The above is the detailed content of How to use which command in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template