Skip to content
Advertisement

How does the word count program count hidden files?

After creating a few directories and hidden files and running the following commands

ls -al | wc -l 
ls -a1 | wc -l 

I get a difference in the total returned by the word count program. The

ls -al | wc -l

command returns one more count. Why is this?

Advertisement

Answer

$ ls -al | head -n 1
total 57600

This line is not shown with -1.

Advertisement