Which vs whereis




















After discussing commands to search for files, let us shift to one command that can help search for the absolute path of executables on the system: which. Without any switches, which displays the first absolute path found for an executable. The absolute paths for multiple executables can be found by specifying the executables one after another. The search may be performed only in the directories listed after -B switch. Names after -f specify all the binaries for which the information needs to be obtained.

Similarly, the search can be restricted to only source code or only manuals, using -s and -m switches. There is no lack of tools for you to find and locate files in the terminal. I hope you have a good idea now about the four useful search tools on Linux systems. If you need more details on their usage, you can check out their manual pages for a detailed documentation. By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy.

Divya divides her time between speculating the existence of aliens and writing about her technical findings. Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers. The which command will also report on your aliases and show you the commands they invoke. The whatis command provides brief descriptions of commands. Each description is associated with one of the man pages for that command as shown in the example below.

Add the man page section e. Note that at the top of the man page you will see a confirmation of the command and the particular man page section:. In this case, which one you end up running will at least in part depend on your search path. The script below will run all three commands and display the output in a useful format.

In fact, it can accept a list of commands and display the command output for looking into each of them. The where , whereis and whatis commands provide useful summaries of commands, showing where the executables are located and pointing to the relevant man pages.

Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search.

Basically, whereis searches for "possibly useful" files, while which only searches for executables. I rarely use whereis. On the other hand, which is very useful, specially in scripts. And if found out, the full pathname of this executable will be printed.

But it seems that whereis and locate don't use the same database. When I installed a software and then used whereis and locate immediately to search for this software.

The result is that whereis could find out some files related to this software while locate couldn't. Do they really use different database? How the database work?

Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 12 years, 2 months ago. Active 2 years, 11 months ago. Viewed 44k times. What's the difference between which and whereis?



0コメント

  • 1000 / 1000