Servicename in ps

Yesterday i wrote in “prstat -x” about the addition of a feature to show the FMRI of the service which the process is part of. ps got a similar enhancement. It’s now possible to have a column called FMRI in the output of ps. In order to show this information, you use -o fmri plus other columns you want to see, as the FMRI alone is most of the time pretty much useless. Well, except you just want to count processes for each service with a quick ps -o fmri| sort | uniq -c | sort -n</sort>.

root@solaris:~# ps -ef -o pid,args,fmri --width 60
 1407 /usr/lib/ssh/sshd -R       svc:/network/ssh:default
 1403 /usr/lib/ssh/sshd -R       svc:/network/ssh:default
 1412 su - root                  svc:/network/ssh:default
 1413 -bash                      svc:/network/ssh:default
 1639 -bash                      svc:/network/ssh:default
 1638 /usr/lib/ssh/sshd -R       svc:/network/ssh:default