Linux offers six different ways to search, and each has its merits. We’ll demonstrate how to use find
, locate
, which
, whereis
, whatis
, and apropos
. Each excels at different tasks; here’s how to choose the right tool for the job.
You’re spoiled for choice when it comes to commands for searching and finding in Linux. Why so many? Well, they each have their specialties and perform better than the others in certain circumstances. You could think of them as a sort of Swiss-Army knife for searching. We’re going to look at each blade in turn and find out its particular strengths.
The find Command
The behavior of the find
command is difficult to determine by trial and error. Once you understand the syntax, you start to appreciate its flexibility and power.
The simplest way to use find
is to just type find
and hit enter.
find
Used in this way find
behaves like ls
, but it lists all of the files in the current directory and those in subdirectories.
Some implementations of find
require you to put the .
for the current directory. If this is the case with your version of Linux, use the following command:
find .