There are many reasons to search for files on the command line. The most common is that you are on a server and can't use your beloved file managers that you use on Windows, Linux or Mac computers. But let's go through the standard use cases. The first use case is finding large files. In our experience, a full hard disk is the problem that most often causes a server to stop working. In the best case, a user can no longer upload images to their WordPress blog, in the worst case, they can no longer log in to fix it.
linux:files:find:big Find all files that are larger than a given size.
$ find ${path_to_check} -type f -size +${size_in_mega_byte}M
try on your machine
explain this command
The second important use case is the search for file names. Where is the php.ini file again? No problem to find, with the right commands. But searching for file types is no problem either. Just search for "*.jpg" and all images with the format jpeg will be searched for and displayed.
linux:files:find:name Find all files with a given name.
$ find ${dir_to_search_in} -name ${filename}
try on your machine
Sometimes, however, you don't search for a specific file, but for a specific content. For example, where did I store the old telephone number of my company again? Or where do I find that spelling mistake I see on the website. That's right, searching for content in files helps.
files:find:pattern Find all files with a specific text pattern in it.
$ grep -rnw '${path_to_check}' -e '${pattern}'
try on your machine
If you ever want to clean up your computer, there is another important use case. Searching for files older than a certain date. Log files, cache files and others like to be files that clutter up a server and computer. Finding such files is relatively easy.
linux:files:find:older Find all files that are older than a given period.
$ find ${dir_to_search_in} -mtime +${number_on_days} -print
try on your machine
When it comes to finding files, there is no getting around the two tools grep and find.