What is the difference between find . and find . -print

From the findutils find manpage:

If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway).

(-print is a find expression.)

The POSIX documentation confirms this:

If no expression is present, -print shall be used as the expression.

So find . is exactly equivalent to find . -print; the first has no expression so -print is added internally.

The explanation of what -print does comes further down in the manpage:

-print

True; print the full file name on the standard output, followed by a newline. If you are piping the output of find into another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the -print0 option instead of -print. See the UNUSUAL FILENAMES section for information about how unusual characters in filenames are handled.


-print is the default action. Some find predicates are considered as actions as opposed to filters or conditions. For instance, -type f is not an action. -exec is an action even though it can also be used as a condition.

Actions include -print, -exec and -ok. Some find implementations have other non-standard action predicates like the -print0, -printf, -execdir, -okdir, -ls...

find files <some-predicates>

Where none of <some-predicates> contain actions is equivalent to:

find files \( <some-predicates> \) -print

(note the parentheses above which are important if there are some -o operators).

When in doubt, best is to use -print explicitly (or -exec printf '%s\0' {} + (or -print0 where available) so that output can be post-processed).

The default -print action is specified by POSIX. Some old find implementations required an explicit -print, but those are usually not found in the wild nowadays.

Also note that some find implementations allow omitting the files, in which case they default to searching into the current directory. That is, for them,

find

is equivalent to

find .
find . -print

That is however not standard, so is best avoided.

On the more verbose (and useful) end of the spectrum, some find implementations also allow passing file paths as argument to a -f option as in:

find -f "$file1" -f "$file2" -print

They are the only find implementations that allow passing arbitrary file paths to find. Other implementations cannot accept file paths like ! or -print... so find "$file" -print (or even find -- "$file" -print) assumes $file is not the name of a find predicate (or option in the first case).

Unfortunately that's not standard nor portable either.


They are the same, they both write out the entire directory hierarchy from the current directory.

From POSIX find documentation:

The following commands are equivalent:

find .

find . -print