Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if there's any way to display some kind of progress info when searching for files in linux using find. I often find myself searching for files on a big disk and some kind of progress indicator would be very helpfull, like a bar or at least the current directory "find" searches in. Are there any scripts that do that, or does find support some hooks?

share|improve this question
thanks for the edit – Vlad Balmos Dec 15 '11 at 8:21
thanks for the answers, i'll check all the solutions and decided which one is better. If it were up to me i would mark all the answers as accepted. – Vlad Balmos Dec 15 '11 at 12:01
depending on which search criteria youb are using locate is much more faster than find – B14D3 Dec 15 '11 at 14:34
up vote 23 down vote accepted

with this trick you can see the current folder - but no progress bar - sorry.

 watch readlink -f /proc/$(pidof find)/cwd
share|improve this answer
that's cool. Should be noted thou that you need superuser privileges in order to access cwd. thanks! – Vlad Balmos Dec 15 '11 at 12:15
Works perfectly. – Jesse Glick Aug 28 '14 at 17:36

There's an example of parallel searches with find in man find. Using it, you can perform multiple checks for every item, performing multiple actions depending on which condition works. The first check may be, for example, simple-print, so all names are printed to stdout. The second check will do what you want. Something like:

find /work \( -fprint /dev/stderr \) , \( -name 'core' -exec rm {} \; \)

If the second check should display filenames, too, you can redirect one of them to stderr using -fprint /dev/stderr.

share|improve this answer

A little utility called pv (pipe viewer) may help. From the fantastic summary by Peteris Krumins:

Pipe viewer is a terminal-based tool for monitoring the progress of data through a pipeline.

You can use pv in a number of ways. When playing around here, I put it immediately after a pipe to monitor progress of the output generated by find (should pass stdin to stdout untouched)

find / -mtime -1h | pv > /dev/null

(I redirected stdout to /dev/null so I could see the progress bar in action without output flying by. This is likely not your intent with find, so tailor accordingly)

I'm honestly not sure how well this works in the wild. For "expensive" finds like the one above (traversing from root), it appeared to work fairly well. For simpler commands in a deeper node in the directory tree, pv failed miserably. These commands are returning results immediately, so a progress bar is probably moot here.

At any rate, play around and see if this works at all for what you need. Food for thought, at least.

share|improve this answer
What would that progress bar show? Neither find, nor pv know how long the search will take,, so they cannot compute the percentage. All we can see in the pv output is the time since the search was started. – minaev Dec 15 '11 at 10:02
This is correct. I had thought there was some magic going on, somewhere, that allowed pv to check the progress of the directory traversal (which is incorrect). Given standard input at a constant rate, pv simply moves the progress bar at a constant frequency. Try yes | pv > /dev/null to observe – tcdyl Dec 15 '11 at 10:07
+1 for a nice utility – Vlad Balmos Dec 15 '11 at 12:26

AFAIK, it doesn't, and implementing it would be nontrivial.

... Hmm. Perhaps a script running find <target dir> -type d first, storing the list and then echoing each dir before running a find <list item> -maxdepth 1 <rest of find parameters> in a for loop.

Note that you're trading a /significant/ loss of performance in exchange for being able to vaguely see what it's doing.

share|improve this answer

I searched for this today and got here via Google. I had a long-running find running on OS X and apparently, watch doesn't exist there. So here's another solution:

lsof -Fn -a -c find -d cwd +r 10

  • lsof = list of open files
  • -Fn = just show the name of the file/directory (prefixed with 'n' character, skip this if you prefer the full lsof output
  • -a = tell lsof to show only lines matching all criteria (by default it shows lines matching any criteria)
  • -c find = show files/directories opened by process named find (actually, process whose name starts with find, but it's case-sensitive so Finder won't show up)
  • -d cwd = show lines with FD (filedescriptor) cwd (current working directory)
  • +r 10 = show output every 10 seconds until no open files are found (find is finished)

This will show the directory find is processing every 10 seconds, so it should give an idea if find is still working and how far it has progressed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.