10
Chapter 1
Searching with locate
Probably the
easiest command to use is
locate
. Followed by a keyword denot-
ing what it is you want to find, this command
will go through your entire
filesystem and locate every occurrence of that word.
To look for aircrack-ng, for example, enter the following:
kali >
locate aircrack-ng
/usr/bin/aircrack-ng
/usr/share/applications/kali-aircrack-ng.desktop
/usr/share/desktop-directories/05-1-01-aircrack-ng.directory
--
snip
--
/var/lib/dpkg/info/aircrack-ng.md5sums
The
locate
command
is not perfect, however. Sometimes the results of
locate
can be overwhelming, giving you too much information. Also,
locate
uses a database that is usually
only updated once a day, so if you just created
a file a few minutes or a few hours ago, it might not
appear in this list until
the next day. It’s worth knowing the disadvantages of these basic commands
so you can better decide when best to use each one.
Finding Binaries with whereis
If you’re looking for a binary file, you can use the
whereis
command to
locate it. This command returns not only the
location of the binary but
also its source and man page if they are available. Here’s an example:
kali >
whereis aircrack-ng
aircarck-ng: /usr/bin/aircarck-ng /usr/share/man/man1/aircarck-ng.1.gz
In this case,
whereis
returned just the aircrack-ng binaries and man page,
rather than
every occurrence of the word aircrack-ng. Much more efficient
and illuminating, don’t you think?