From owner-freebsd-questions Thu May 27 10:36:47 1999 Delivered-To: freebsd-questions@freebsd.org Received: from gator.adeptscience.co.uk (gator.adeptscience.co.uk [193.116.153.5]) by hub.freebsd.org (Postfix) with ESMTP id 703A51500E for ; Thu, 27 May 1999 10:36:31 -0700 (PDT) (envelope-from reese@chem.duke.edu) Received: from porthos.ourway.org (async249-44.async.duke.edu [152.3.249.44]) by gator.adeptscience.co.uk (8.9.3/8.9.3) with SMTP id SAA23621 for ; Thu, 27 May 1999 18:36:25 +0100 (BST) Message-Id: <1.5.4.32.19990527173638.00e5eb50@chem.duke.edu> X-Sender: reese@chem.duke.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 27 May 1999 13:36:38 -0400 To: freebsd-questions@freebsd.org From: Charles Reese Subject: Re: How to check which ports are in use? Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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