linux 求解

find . -type f -name "*.jpg" -print | xargs tar -czvf images.tar.gz

请问这里的-print 是啥意思?为啥前面有一个"-"

最佳答案

man里面写得很清楚了,请看文档

-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 FILE‐AMES section for information about how unusual characters in filenames are handled.