Finding forgotten files with find

Where, oh where, did that file go? Sometimes locating a file requires more than cursing at your computer or listing directory contents with ls. Instead, you can use the find command, which lets you search in dozens of ways, including through the entire directory tree (Code Listing 2.11) or through directories you specify (Code Listing 2.12).

To find a file:

  • find . -name lostfile -print
    Along with the find command, this specifies to start in the current directory with a dot (.), provide the file name (-name lostfile), and specify that the results be printed onscreen (-print) (Code Listing 2.11).

To find files starting in a specific directory:

  • find /home/deb -name pending* -print
    This command finds all of the ...

Get Unix: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.