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.

What is the difference between:
find . -name "*.txt" and find . -name "*.txt" -print ?

I mean what is the use of print in find. I see that it prints the results anyway so why is this option available?

share|improve this question

1 Answer 1

In very old versions of find, -print wasn't implicit so was required.

Nowadays, it is the default action but is still useful when combined with -prune to avoid the default action to encompass the pruning. eg:

This won't print files named foo under /tmp:

find /tmp -name foo -prune -o -type f -print

This will:

find /tmp -name foo -prune -o -type f
share|improve this answer
    
In the following nothing is printed find . -type f \( -name ".vim" -prune \) -print. Why? –  Jim Jun 29 '13 at 21:37

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.