Finding Files
Explore how to use the find command to search for files by name, pattern, and modification time on the command line. Understand options for case-insensitive searches, limiting search depth, and displaying file attributes, helping you navigate and manage files in complex directory structures.
We'll cover the following...
Sometimes, we don’t know where to look for a file. Maybe we’ve misplaced it, or maybe we’re the type to save everything we’ve ever done and have lost track of the file several months ago. GUI interfaces usually have some tool that can search through our disk and find files. A tool on the CLI does that too, and it’s the appropriately named find command.
The find command
We can locate files by name, last modified date, or even by the content they contain with find.
In Creating and Reading Files, we created a file named greetings.txt in the root directory. Let’s use the find command to look for that file in the root folder:
$ find / -name ...