hahaha

hahaha

The Difference Between which, whereis, and whatis in Linux

which#


The which command is used to query the location of a command defined in the PATH environment variable. It searches for the specified command in all paths defined in the PATH environment variable. If there are multiple commands with the same name, which will only display the path of the first command found. To use the which command, simply enter which followed by the command name to be queried in the terminal.
which python3
will return the path of the Python interpreter. In the above command, which will search for the location of the Python command in the PATH environment variable and return the path of the first Python interpreter found. The which command is useful when you need to determine the location of an executable file as soon as possible.


whereis#


The whereis command is similar to which, but it also searches for other file resources, such as command manuals (man) and source code, in the system's predefined fixed paths in addition to the PATH environment variable. whereis does not display the path of the specified command unless the command is installed and at least one target file is found in the standard directories. Here is an example of the whereis command:
whereis python3
Executing this command will display the locations of the Python binary files, manual pages, and source code. The whereis command is more suitable for searching for commands in fixed directories other than PATH, so it can be used to locate the location of specific file types.


whatis#


The whatis command is used to display a one-line summary of a given command. The whatis command returns a brief description of the query result and is mainly used in Linux to query the functionality and usage of commands. Here is an example of the whatis command:
whatis python3
In this example, the whatis command will return a string describing the functionality of the python command. The whatis command is faster than directly consulting the manual page when you need to quickly know the purpose of a command.


Based on the above introduction and examples, it can be seen that the main differences between which, whereis, and whatis lie in the content searched and the results returned. The which command is mainly used to find the location of commands in the PATH environment variable; the whereis command searches for other resources in the system's fixed directories in addition to PATH; the whatis command is mainly used to obtain the description of the functionality and usage of specific commands.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.