Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 1995 21:59:20 +0200 (MET DST)
From:      guido@gvr.win.tue.nl (Guido van Rooij)
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: lsof ported?
Message-ID:  <199503271959.VAA05009@gvr.win.tue.nl>
In-Reply-To: <199503271735.TAA16197@uriah.heep.sax.de> from "J Wunsch" at Mar 27, 95 07:35:27 pm

next in thread | previous in thread | raw e-mail | index | archive | help
J Wunsch wrote:
> 
> As Guido van Rooij wrote:
> > 
> > There is this handy program that lists all open file descriptors
> > called lsof. It not only lists all open inodes but sockets as well.
> 
> ...exactly what fstat(1) is doing.  So why another program?
> 

Fstat does:
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
guido    tcsh        4954   19* unix stream f061f494
guido    vi          4953   10* unix stream f05ea514 <-> f05ed394
guido    telnet      4766    3* internet stream tcp f05b1700
guido    telnet      4689    3* internet stream tcp f062ad00
root     inetd        130   12* internet stream tcp f05d0200
root     inetd        130   13* internet stream tcp f059e000
root     inetd        130   14* internet stream tcp f05a0e00
root     sendmail     127    4* internet stream tcp f05c9200
root     nfsd         112    3* internet stream tcp f05c9700

(a smal sample).

Lsof does:
syslogd      37     root    4u  inet 0xf08cf814        0x0    UDP *:syslog
portmap      58     root    3u  inet 0xf08cf394        0x0    UDP *:sunrpc
portmap      58     root    4u  inet 0xf0a90214        0x0    TCP *:sunrpc
gated        60     root    7u  inet 0xf0aafa94        0x0    UDP *:0
gated        60     root    9u  inet 0xf0abb380        0x0   ICMP
gated        60     root   11u  inet 0xf0abb294        0x0    UDP *:route
named        62     root    4u  inet 0xf0aafc14        0x0    TCP *:domain
named        62     root    5u  inet 0xf0abb914        0x0    UDP iaehv.IAEhv.nl
:domain
named        62     root    6u  inet 0xf0abb814        0x0    UDP localhost.IAEh
v.nl:domain
named        62     root    7u  inet 0xf0abb714        0x0    UDP iaehv.IAEhv.nl
:domain
named        62     root    8u  inet 0xf0abb614        0x0    UDP iaehv.IAEhv.nl
:domain
named        62     root    9u  inet 0xf0abb514        0x0    UDP *:domain
lpd          65     root    5u  inet 0xf08d4194        0x0    TCP *:printer
sendmail     69     root    5u  inet 0xf0935f94        0x0    TCP *:smtp

Now...I prefer the second one. Besides, lsof has a bunch of options
(among others to only list open network files).

-Guido



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503271959.VAA05009>