I am using wc command to find the no of files in a directory
I am using command ls | wc -w
how should I modify the command to find exact no of files because this command gives extra number if files have space in their name.
>Solution :
use ls -l | wc -l
ls -l gives files in line format and wc -l counts the newline character and hence gives the answer.