Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

how to use netstat on a specific port in Linux

Writer Matthew Barrera

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

1

3 Answers

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

Output

Starting nmap 3.55 ( ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
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 
3

use netstat -anp | grep portNumber

1

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

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy