Skip to content
Latchkey

find -print: Default Output and -ls

find -print writes the path of each match on its own line; it is the default action.

find prints matches by default, but the moment you add another action that default disappears, which is the source of many -prune surprises.

What it does

find -print outputs each matched path followed by a newline. If no action is given, -print is applied automatically. As soon as you add an action like -exec or -prune, the implicit -print is gone, so you must add it back explicitly where you want output. -ls prints ls -l style details.

Common usage

Terminal
find . -name '*.log' -print
find . -name '*.log' -ls
find . -name node_modules -prune -o -type f -print

Options

ActionWhat it does
-printPrint the path plus a newline (the default)
-print0Print the path plus a NUL byte
-lsPrint ls -l style details for each match
-printf FMTGNU: print a custom format

In CI

Remember that adding -prune (or any action) suppresses the automatic -print, so a prune expression that "outputs nothing useful" usually just needs an explicit -print on the action side. Pipe -print to wc -l to count matches.

Common errors in CI

No output from a working expression almost always means the implicit -print was canceled by another action; add -print back. -ls and -printf differ across implementations: -printf is GNU only, so on BSD/macOS find use -print with a downstream tool or -exec stat. Lines with spaces break naive parsing; prefer -print0.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →