TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Should I need to use -print in a find command?

1 pointsby shivajikobardanalmost 2 years ago
find &#x2F; -type f ! -perm 0777 -print<p>vs<p>find &#x2F; -type f ! -perm 0777<p>Both print same results.<p>I&#x27;ve seen somewhere to use -print0 but not sure why.

2 comments

jeffreygoestoalmost 2 years ago
At least for print0 I can answer. It delimits the output with zero chars instead of spaces. That is useful if you process the output with xargs (add &#x27;-0&#x27; there, see help text or man page). If your file or directory names contain spaces, they will stay together with the zero delimiter, whereas without they would be split into pieces abd xargs does not see valid file names. In a directory containing files with spaces, try both<p>find . -type f | xargs ls -1<p>find . -type f -print0| xargs -0 ls -1
compressedgasalmost 2 years ago
No, print is the default action. However if you use some other action such as -delete or -exec, if you want to print also, you must include the print option.