Finding Files
Finding files using the CLI
When have become accustomed to just being able to use a GUI to search for and find files. Using a CLI we do not have that ability, so we have to use commands to do it. This section will present several commands that will help you in determining where a specific file is located.
updatedb & locate
These two commands go hand-in-hand. The locate command is only as good as the last time the updatedb command was issued. The updatedb command will update a database of files in Linux. You can then use locate to find a file by name. These two commands are great if you are doing a search based on a filename.
find
The find command is extremely powerful! This is a command I suggest you practice and gain a strong understanding of what it can do. With find you can find a file based on specific characterizes such as: size, permissions, type of file, owner and timestamps.
https://linux.die.net/man/1/find
The man page (above url) might be a bit hard to understand. I suggest you visit the following two links to see examples of find commands that you can run. I would highly suggest you test each of these commands out to gain a better understanding of the syntax of the find command.
https://www.tecmint.com/35-practical-examples-of-linux-find-command/
https://www.linuxshelltips.com/find-files-based-on-timestamp/
type
The type command provides you with details about the location of the command or if the command is built directly into your shell. This is important as sometimes you can have a command that is both built into your shell and one that is not. Knowing the difference is important as they can act differently.
which & whereis
The whereis command provides you with the location of the binary file (compiled code), man pages and source. While the which command provides the full path to the binary file.