Apollo Connecting the World

Diligence and Intelligence

Posts Tagged ‘directory

Count number of lines of all files in a directory

leave a comment »

In Linux, given a directory “dir”, if you want to count number of lines of all files (e.g. .txt files) in the directory (inclucing sub-directory), simply type this command:

find ./ -name ‘*.txt’ | xargs wc -l


NOTE: This method works in Fedora 12

Written by apollozhao

2011/04/05 at 18:39

Posted in Linux, wc

Tagged with , , , , ,