The postfix daemon has only the name "master" if I use netsat
like this:
root@myhost# netstat -tulpen| grep master
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 53191445 13640/master
If I use ps
I get a more verbose name:
root@myhost# ps aux| grep 13640
root 13640 0.0 0.0 25036 1500 11:35 0:00 /usr/lib/postfix/master
Is there a way to tell netstat
to output the long name?
In this case it would be /usr/lib/postfix/master
.
Update
It seems that netstat can't do it. If you know how to do this with an other tool, then this is valid question, too. (But netstat based solutions are still prefered).
Update2
All answers work. Thank you very much for showing your unix knowledge. But up to now the answers are far too long/complicated.
Is there no easy solution? I can install any tool which is needed, but I want the usage to be simple to use.
I can't give the bounty to all of you …
There are several answers which to post processing to get the needed information. Each answer uses a different way and I don't see that one solution is better than an other.
Unfortunately there seems to be no unix/linux which can do this out of the box. But that's not the fault of you, who tried to help me.
Unfortunately I can't give the bounty to all answers 🙂
I gave the bounty to the user with the least reputation points.
Best Answer
As you already figured
netstat
by default cannot provide fullcmdline
output with-p
option. As per source it seem to limited to 20 chars and only lists portion of the full cmdlineYou could write your own wrapper around netstat to display full details. Added below snippet of python code which displays full cmd line.
Sample output:
You could write your own wrapper around similar lines and add to your toolbox!