sudo process in process list

I've a different behaviour for the same command on 2 different machines:

Server 1:

sudo /bin/ps -AF | grep sudo

root 19370 14291 0 1809 828 3 11:12 pts/1 00:00:00 grep sudo 

Server 2:

sudo ps -AF | grep sudo

root 17706 12645 0 5604 1228 2 11:13 pts/0 00:00:00 sudo ps -AF 
root 17707 12645 0 2402 896 1 11:13 pts/0 00:00:00 grep sudo

Sever 2 displays the sudo process, Server 1 not. How can that be?


Solution 1:

Depending on the ps version and which distro you are using, ps command may doesn't show itself in the listing.

CentOS, procps version 3.2.7:

$ sudo /bin/ps -AF | grep sudo
quanta   19175 14068  0 15302   740   7 17:04 pts/1    00:00:00 grep sudo

Gentoo, procps version 3.2.8:

$ sudo /bin/ps -AF | grep sudo
root      4842  4783  0  1512  1468   0 16:54 pts/10   00:00:00 sudo /bin/ps -AF
quanta    4843  4783  0  1059   844   1 16:54 pts/10   00:00:00 grep --colour=auto sudo