linux count grep lines code example Example 1: grep count lines Click to copycat myfile | wc -l Example 2: grep count lines Click to copycat -n myfile