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:
- 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).
find . -name lostfile -print
To find files starting in a specific directory:
- This command finds all of the ...
find /home/deb -name pending* -print
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.