-   Linux - Newbie (
-   -   About the -print option in find command (

the_gripmaster 11-06-2011 07:59 AM

About the -print option in find command
Is there a difference between


find / -iname "*.mp3"


find / -iname "*.mp3" -print
Both give the same output.

I RTFM and could not find any clear explanation regarding -print option, whether it is a default parameter. (Please note that my question is not related to the difference between -print and -print0.)


catkin 11-06-2011 08:41 AM

From the find man page (in the OPTIONS section preamble): "If no expression is given, the expression -print is used".

colucix 11-06-2011 08:47 AM

Indeed it is a default and you can omit it, but there are some cases where it is necessary to specify it, for example in conjunction with -prune. The output of the two following commands differs:

find /home -wholename /home/colucix -prune

find /home -wholename /home/colucix -prune -o -print

David the H. 11-06-2011 02:15 PM

Another example, and a more detailed explanation, can be found at the end of this page:

All times are GMT -5. The time now is 09:52 PM.