how to count the number of times a word appears in a file in linux code example Example: linux count number of times word appears in file grep -o 'word' filename | wc -l