When you're trying to find your way around the Linux file system and want some information on specific commands, the whereis, whatis, and which commands can help. Each provides a different view of the command you're asking about. In this post, I'll compare these commands and explain what they tell us and what they don't tell us.\nwhich\nThe which command is the simplest of the three. When you use it to ask about a Linux command, it will run down your search path looking for executable files by the name you specify. These can be commands that are available on your system as well as scripts. As long as the files provide you with execute privilege, they fit the bill. Here are some examples:\n$ which date\n\/usr\/bin\/date\n$ which init\n\/usr\/sbin\/init\n$ which loop\n~\/bin\/loop\n\nThe which command does nothing more than show the location of the file. It also stops as soon as it finds a match. The first location in your search path that contains an executable file by the name specified is the one you will see listed.\nIn general, which is used to display the location of a command so that you will know what executable you are running when\u00a0you type the name of the command. Sometimes it's important to verify that you're not running a different command than the one you expect to run. A well-crafted search path should help ensure that you are running the expected command. In general, this means having the system directories like \/usr\/bin, \/usr\/sbin and \/usr\/local\/bin precede your personal directory and personal bin directory.\nwhereis\nThe whereis command is more liberal in its approach to locating files. It will find the file you are looking for along with related commands. On the other hand, it only looks for the binary, source, and manual page files for a command. It doesn't require that the files be executable, and it doesn't follow your search path. It only looks in particular locations and, as you can see from the example below, one of these might be your bin directory.\nNotice that the last two of the files shown in this whereis output are gzipped man pages that are unzipped when you use the man command to read them.\n$ whereis date\ndate: \/usr\/bin\/date \/home\/shs\/bin\/date \/usr\/share\/man\/man1\/date.1.gz\/usr\/share\/man\/man1p\/date.1p.gz\n\nwhatis\nThe whatis command doesn't look for files at all. Instead, it provides a brief explanation of Linux commands. It pulls the information from the related man pages. Here's an example:\n$ whatis date\ndate (1) - print or set the system date and time\ndate (1p) - write the date and time\n\nIn the command above, the whatis command is providing two very brief explanations of the date command. It pulls the first of these descriptions from the primary man page and the second from the man page stored in the 1p folder (\/usr\/share\/man\/man1p\/date.1p.gz). If you want to view these man pages, you could use commands like these:\n$ man date\n$ man 1p date\n\nNote that the NAME section in the related man pages include the brief descriptions shown above.\n$ man date | head -4\nDATE(1) User Commands DATE(1)\n\nNAME\ndate - print or set the system date and time\n\n$ man 1p date | head -10\nDATE(1P) POSIX Programmer's Manual DATE(1P)\n\nPROLOG\n This manual page is part of the POSIX Programmer's Manual. The Linux\n implementation of this interface may differ (consult the corresponding\n Linux manual page for details of Linux behavior), or the interface may\n not be implemented on Linux.\n\nNAME\n date \u2014 write the date and time\n\nWrap-Up\nThe whereis, whatis and which commands can be helpful for ensuring you're running the command you intend, finding commands and related files and giving you very succinct descriptions of what the commands can do for you.