Linux which command

Linux 命令大全Complete Linux Commands

The Linux which command is used to locate files.

The which command searches for files that match the criteria in the directories set by the environment variable $PATH.

Syntax

which [文件...]

Parameters:

  • -n<filename length> Specifies the filename length. The specified length must be greater than or equal to the longest filename among all files.
  • -p<filename length> Same as the -n parameter, but the <filename length> here includes the path of the file.
  • -w Specifies the column width when outputting.
  • -V Displays version information.

Examples

Use the command "which" to view the absolute path of the command "bash". Enter the following command:

$ which bash

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

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

Linux 命令大全Complete Linux Commands

Other Extensions