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.
lsof
instead.lsof
has lots of features. On the other handnetstat
is OS-dependent, and its features don't completely overlap with those oflsof
. You should use both when appropriate.netstat
is deprecated in favor ofss
. It has the same limitation as you point out, however.