Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 1999 13:36:38 -0400
From:      Charles Reese <reese@chem.duke.edu>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to check which ports are in use?
Message-ID:  <1.5.4.32.19990527173638.00e5eb50@chem.duke.edu>

next in thread | raw e-mail | index | archive | help
At 04:50 PM 5/27/99 +0100, you wrote:
>W Gerald Hicks wrote:
>
>>> Hi there,
>>> can someone point me to the place where I can read about how to 
>>> get information about which ports are currently in use?
>> 
>> Ports?   You mean software installed from the ports collection or
>> something else?
>> 
>> 'pkg_info -a' will show gobs of information for the former...
>> 
>> cd /usr/ports/sysutils/lsof && make install clean && man lsof
>> should help with other types of 'ports'.
>
>If he's talking about tcp/udp ports (as in the type listed in
>/etc/services), `netstat -an | grep LISTEN' will show which of those
>have a program listening for connections.
>
>hopefully Andre will clarify what "ports" he's asking about.
>
>-- 

But that will only show the port number (or service name if its in
/etc/services) not the actual program that is listening.  lsof will show the
file that has the port open ie. 

/usr/local/sbin/lsof -i :22
COMMAND   PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
sshd1     220 root    3u  inet 0xf128cf00      0t0  TCP *:ssh (LISTEN)
sshd1   23522 root    5u  inet 0xf1383800      0t0  TCP aramis.ourway.org:ssh->p
orthos.ourway.org:pirp (ESTABLISHED)


>Ben Smithurst
>ben@scientia.demon.co.uk
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message
>

Cheers
Charlie Reese

>

------------------------------------------------------
One Unix* to Rule them all, One Resolver to Find them,
One IP to Name them all, In the Zone that Binds them.
------------------------------------------------------
*FreeBSD of course.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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