About Linux FAQ

Browse More FAQs:

How do I find out what ports are listening/open on my Linux/FreeBSD server?

Posted by Vivek Gite [Last updated: November 8, 2006]

There are different commands on both Linux and UNIX server to find out what tcp/udp ports are listening or open on your own server. You can use netstat command, which print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships etc. Another (and suggested) option is to use lsof command, which list open files, and ports on Linux, FreeBSD, Solaris and other Unixish systems.

netstat Command Example

# netstat --listenDisplay open ports and established TCP connections:$ netstat -vatnFor UDP port try following command:$ netstat -vaunIf you want to see FQDN, remove -n flag:$ netstat -vat

lsof Command Examples

Display list of open ports
# lsof -iTo display all open files, use:# lsofTo display all open IPv4 network files in use by the process whose PID is 9255, use:
# lsof -i 4 -a -p 9255

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. vinod Says:

    I used lsof command in freebsd 5 i am not getting any output for checking tcp/udp ports which are listening or open on my server

  2. ramakrishna Says:

    What is the equivalent port for com9 on linux?How do i find out com port equivalents in linux?Thanks

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.