How do I count the number of lines in a directory in Linux?

How do I count the number of lines in a directory in Linux?
Answer
2 Answers
  1. make a list of all files under current directory with find . – type f.
  2. filter out files from “exclude” dirs with grep -v.
  3. xargs will read list of files from stdin and pass all files as options to cat .
  4. cat will print all files to stdout.
  5. wc will count lines.
 

Tìm kiếm

Back
Top