Using Linux Find


Linux find utility is a great tool for digging out files buried in the vast depths of your disk platters. Not quite as good as  Google, but a lot smaller and already built into your Linux OS.

If you have an inkling of your file details, find can locate it. I misplaced some files a couple of months ago. I knew I had worked on them on another machine and was pretty sure, a copy resided on my disk, somewhere.

I found a date reference to the files. It was all I needed. find did the rest.

I knew I had last worked on the files on 19 July. I calculated the number of days, using fingers and toes, and passed the number to 'find'.

It was 137 days since I last modified or accessed the file. Here's the find command.

find . -mtime 137 -print


find - the find command
'.'  - start search in the current directory
-mtime - look at files last modified
137 - days ago
-print - print out results

Minutes later, I had my files.

You can search for files by name, using -name instead of -mtime.

Add wildcards:

find . -name *.gif

Searches for all gif files in current directory and sub-directories.