”, “-p”, “-w” and “-V”."/> ”, “-p”, “-w” and “-V”.">

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

How to use which command in Linux?

Guanhui
GuanhuiOriginal
2020-06-28 14:57:234131browse

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 "-n59ffcea55aee92a7bc38770bb38c7fa7", "-p59ffcea55aee92a7bc38770bb38c7fa7", "-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 [文件...]

which Parameter

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

-p59ffcea55aee92a7bc38770bb38c7fa7 Same as the -n parameter, but the 59ffcea55aee92a7bc38770bb38c7fa7 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

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

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

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!

Statement:
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