|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to find port numbers a web server is listening to
I want to write a program to list all port numbers a process like web server is listening to.Is there a any unix command to find the port numbers and the processes(pid) connected to that port.
|
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Quote:
u can write the script in shell for a particular task of listing in linux we have commands lsof -i TCP (displays online open tcp ports) lsof -i UDP above commands work for linux only netstat -anp | head -20 nmap -anp ( if the nmap utility is installed in linux system) thru netstat only we can get much of the information regarding the open ports |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
you can also use "sockstat" if applicable.
|
|
#4
|
|||
|
|||
|
Quote:
sockstat works on BSD netstat can be used for unix platform of solaris,hpux |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
netstat -na |grep LISTEN to find the listening ports in HP-UX,Solaris
netstat -na|grep CONNECTED to find the ports connected in Linux box. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
On solaris:
pfiles <pid> |
| Sponsored Links | |
|
|
#7
|
||||
|
||||
|
You can try, on linux, Code:
# netstat -lpn | grep httpd .. if you know that the server is httpd (apache), there you can figure out what ports and address has apache bound to as well as process' pid. on freebsd systems try Code:
# sockstat -ln | grep httpd |
| Sponsored Links | ||
|
![]() |
| Tags |
| linux, linux commands |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find if remote n/w port is listening on HP-UX from the binary | einsteinBrain | IP Networking | 3 | 01-19-2012 10:52 AM |
| how to check remote server port listening from application. | einsteinBrain | HP-UX | 0 | 01-18-2012 01:33 PM |
| Find file that maps to a listening port | phpfreak | Shell Programming and Scripting | 2 | 02-27-2010 08:55 PM |
| VNC Server http listening port | kxchen_home | Linux | 6 | 02-06-2004 11:23 PM |
| port not listening.. | Prafulla | IP Networking | 1 | 12-12-2001 08:46 AM |
|
|