Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Guys i want to know if my specific port is running a server using netstat? how do i achieve that?

share|improve this question

migrated from May 31 '13 at 9:27

This question came from our site for professional and enthusiast programmers.

netstat -anp | grep portNumber – rags May 31 '13 at 5:47
up vote 8 down vote accepted

You can use

netstat -pnlt | grep ':portno'

another option , you can use nmap tool for checking open ports on the server

nmap -sT -O localhost


Starting nmap 3.55 ( ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (
(The 1653 ports scanned but not shown below are in state: closed)
22/tcp    open  ssh 
25/tcp    open  smtp
111/tcp   open  rpcbind
Device type: general purpose

Netstat Example :

[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name 
tcp        0      0 :::80                       :::*                        LISTEN      1164/httpd          
share|improve this answer
and what part there in the results i can determine if it is a server? – Monkey May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ). – krizna May 31 '13 at 8:14

use netstat -anp | grep portNumber

share|improve this answer
so im getting list of many port 80 connections. how do i find the server port? – Monkey May 31 '13 at 6:10

I think netstat -nat | grep port | grep LISTEN should do the trick.

share|improve this answer
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with -l instead of -a. And the question was not only about tcp ports so the -t option shouldn't be there. – tobias.pal Mar 24 at 8:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.