To output all lines into a file
$ ps -e >/tmp/ps.txt
To count it with wc -l
$ wc -l /tmp/ps.txt 172
To count it without exporting a file.
$ ps -e | wc -l 173
ps -e | wc -l get one more line?
I don't think ctrl-d has the right explanation for my question.
$ echo "test" | wc -l 1
Please try it in your terminal, it would yield 2 as ctrl-d would say.