Linux study notes -- which command (SEARCH Command)
Which, which indicates to search for the location and alias of a command from the PATH specified by the PATH environment variable.
Which command features:
1) The "which" command can only search for system commands, but cannot search for common files. 2) The "which" command searches for the location of a system command from the PATH specified by the PATH environment variable and returns the first search result.
PATH environment variable:
PATH: determines which directories The shell will look for commands or programs. The PATH value is a series of directories separated by ":". When you run a command, linux searches for compilation links under these directories.
The which command differs from the whereis command:
1) The "whereis" command queries the command location and help document location; the "which" command queries the command location and command alias. 2) The "whereis" command searches for data from the database, and the database is not updated in real time. The "which" command queries data from the PATH specified by the PATH environment variable, and is real-time.
1. Command Format:
Which command name
2. Common examples:
1) view the location and alias of the "ll" command