linux command run a grep command count number of lines code example Example 1: grep count lines cat myfile | wc -l Example 2: grep count lines cat myfile | wc -l