Please change <filename> value with your actual file name and it will return number of files in file as output.
Following command will count number of lines in /etc/passwd files and print on terminal. We can also use –lines in place of -l as command line switch.
$ wc -l /etc/passwd
Count Total Character in File:
Use -m or –chars switch with wc command to count number of characters in a file and print on screen.
$ wc -m /etc/passwd
Count Total Words in File:
Use -w or –words switch with wc command to count number of words in a file and print on screen.
$ wc -w /etc/passwd