So I am in a Linux course and having trouble figuring out this question. I need to come up with a command that a user can execute to display word counts for all readable files in a folder, without displaying any error messages. I’m sure this is simple but I can find it anywhere.
Share
find /home/jon/ -maxdepth 1 -readable -type f -exec wc -w {} \;You can use
findwith-type ffor files only,-maxdepth 1so thatfinddoesn’t search in sub-directories,-readableso it only searches readable files andwc -wto count the words in the files:To show that the
wc -wis correct:From man find: