Linux which command
The Linux which command is used to locate files.
The which command searches directories set in the $PATH environment variable for files that meet the criteria.
Syntax
which [文件...]
Parameters:
- -n
Specify the file name length; the specified length must be greater than or equal to the longest file name among all files. - -p
Same as the -n parameter, but here the includes the path of the file. - -w Specify the width of the columns in the output.
- -V Display version information.
Example
To use the "which" command to view the absolute path of the "bash" command, enter the following command:
$ which bash
After running the above command, the output is as follows:
/bin/bash #bash可执行程序的绝对路径
Linux Command Reference