How to count number of lines in a file Counting total lines in a file is super simple in Linux wc -l filename You can use the same command to count total files in directory by running find directory | wc -l