Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The find command is taking too long on my machine to complete. When I use time command, I find that sys time and user time are too small as compared to real time. Is my find process not getting scheduled properly?

I interrupted the neverending find command and got the following statistics:

Real time : 5min
Sys time : 1.1 sec
User time : 3 sec

I was running

find / -name ls 2>/dev/null
share|improve this question

2 Answers 2

up vote 6 down vote accepted

for the find command, disk IO is likely to be a much more significant bottleneck than CPU time.

compare your

find / -name ls 2>/dev/null   

with the equivalent

locate ls | grep "/ls$"

or

locate -r "/ls$"

or (fastest for finding location of commands on your path)

which ls
share|improve this answer

Wanted to add my two cents... You might want to look at using mlocate. It will cache the files on your system and allow you to use the 'locate' command to quickly find what you're looking for. And you can update the cache by using the 'updatedb' command. The only disadvantage is that it isn't as easy used in scripts as find because it requires root privs by default to use.

Find doesn't cache anything, it will just rescan every time. Like what RedGrittyBrick said, your disk will cause the bottleneck in your system.

share|improve this answer

Your Answer

 
discard

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.