how to use wc to count number of times a word appears in file linux command code example Example: count occurrences of word in unix bash $ grep -o -i needs inspire.txt | wc -l