# Commands

#### man

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/image.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/image.png)

However, if we use the <span class="pr-block">-k</span> option with <span class="pr-block">man</span>, we can perform a keyword search as shown below:  
man -k passwd

We can further narrow the search with the help of a regular expression:  
man -k '^passwd$'<sup class="footnote-ref">[](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/getting-comfortable-with-kali-linux/finding-your-way-around-kali/basic-linux-commands#fn2)</sup>

#### apropos

With the *apropos*<sup class="footnote-ref">[3](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/getting-comfortable-with-kali-linux/finding-your-way-around-kali/basic-linux-commands#fn3)</sup> command, we can search the list of man page descriptions for a possible match based on a keyword. Although this is a bit crude, it's often helpful for finding a particular command based on the description. Let's take a look at an example. Suppose that we want to partition a hard drive but can't remember the name of the command. We can figure this out with an <span class="pr-block">apropos</span> search for "partition".  
apropos partition

#### which

The <span class="pr-block">which</span> command<sup class="footnote-ref">[1](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/getting-comfortable-with-kali-linux/finding-your-way-around-kali/finding-files-in-kali-linux#fn1)</sup> searches through the directories that are defined in the *$PATH* environment variable for a given file name. This variable contains a listing of directories that Kali searches when a command is issued without its path. If a match is found, <span class="pr-block">which</span> returns the full path to the file as shown below:

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/nw4image.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/nw4image.png)

#### locate

The *locate* command<sup class="footnote-ref">[2](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/getting-comfortable-with-kali-linux/finding-your-way-around-kali/finding-files-in-kali-linux#fn2)</sup> is the quickest way to find the locations of files and directories in Kali. In order to provide a much shorter search time, <span class="pr-block">locate</span> searches a built-in database named <span class="fp-block">locate.db</span> rather than the entire hard disk itself. This database is automatically updated on a regular basis by the *cron* scheduler. To manually update the <span class="fp-block">locate.db</span> database, you can use the <span class="pr-block">updatedb</span> command.

#### find

The *find* command<sup class="footnote-ref">[3](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/getting-comfortable-with-kali-linux/finding-your-way-around-kali/finding-files-in-kali-linux#fn3)</sup> is the most complex and flexible search tool among the three. Mastering its syntax can sometimes be tricky, but its capabilities go beyond a normal file search. The most basic usage of the <span class="pr-block">find</span> command is shown in Listing 14, where we perform a recursive search starting from the root file system directory and look for any file that starts with the letters "sbd".

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/mAtimage.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/mAtimage.png)