I'd like to count all the ordinary file on home directory with commands:
$ find ~ -type f | xargs echo | wc -w
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
It prompts
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
What's the problem with usage?
It appears that some of your filenames have apostrophes (single quote) in their names.
Luckily,
find
andxargs
have ways around this.find
's-print0
option along withxargs
's-0
option produce and consume a list of filenames separated by theNUL
(\000
) character. Filenames in Linux may contain ANY character, EXCEPTNUL
and/
.So, what you really want is:
Read
man find;man xargs
.