How to get a word count in Unix

Total time: 1 minute 

This short guide will teach you how to get a word count in Unix using Bash/Terminal.

Posted in these interests:

unix
PRIMARY
18 subscribers
linux
75 subscribers
sysadmin
19 subscribers

In your shell, or Terminal on a Mac, type:

wc -l filename

.. replacing filename with the actual name of the file. This should print the number of lines like so:

$ wc -l test.php 
      18 test.php