![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command to release a port in AIX | hemanshupatira | AIX | 5 | 05-06-2008 08:13 AM |
| required command to know the port no. | Amit_kolurwar | SUN Solaris | 1 | 04-23-2008 12:05 AM |
| disabled telnet now need port 23 or port 22 | panzerkw | SUN Solaris | 3 | 03-05-2007 12:08 PM |
| How to set baude rate of Serial port using setserial or other command | zaheer031 | UNIX for Advanced & Expert Users | 1 | 09-29-2004 08:20 AM |
| BitTorrent port 6969 blocked... how to get around the blocked port | PenguinDevil | IP Networking | 1 | 05-05-2004 08:03 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Command to know port no
Hi,
I want to know command which will display which application is running on which port.... apart from netstat, |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
configuration file is /etc/inet/services
for ex: to know about telnet port u can use # grep telnet /etc/inet/services telnet 23/tcp. Awadhesh |
|
#3
|
|||
|
|||
|
Thanks Awadhesh for your quick response, but any command is there which will display application name along with port number?
|
|
#4
|
||||
|
||||
|
#5
|
||||
|
||||
|
I am not aware other that netstat.
|
|
#6
|
|||
|
|||
|
Hi,
netstat in Solaris will not show which process is using certain port, do fix that try to use pfiles, this is a cool tool in Solaris which shows you all the files openned by the process, since a connection is a file in Unix , using pfiles is easy. Look the following shell script : ----- for a in `ps -ef | nawk '{print $2}'` do pfiles $a | grep 80 (your port number) done ----- Later you can automate an improve this script, this is just to give U a clue how to find your stuff there, hope that helps. Regarding, Fernando Ramos. |
|
#7
|
||||
|
||||
|
I actually wrote a fairly comprehensive script to do this a while back
Code:
#!/bin/bash
# use this where lsof (for lsof -i tcp:<port>) isn't available
AWK="/usr/bin/awk"
ECHO="/bin/echo"
PARGS="/usr/bin/pargs"
PFILES="/usr/bin/pfiles"
PS="/usr/bin/ps"
SED="/usr/bin/sed"
${PS} -ef | ${SED} '1d' | while read PS_LINE; do
PS_PID=$( ${ECHO} "${PS_LINE}" | ${AWK} '{print $2}' )
PS_PROC=$( ${PARGS} ${PS_PID} | ${SED} -n '1p' | ${SED} 's/^[0-9][0-9]*:[ ]*\(.*\)$/\1/' )
PORT_USAGE=$( ${PFILES} ${PS_PID} | ${AWK} '/AF_INET/ { printf( "\t%s(%s)\n", $3, $5 ) }' )
if [ "${PORT_USAGE}" != "" ]; then
${ECHO} "${PS_PROC} [PID: ${PS_PID}]"
${ECHO} "${PORT_USAGE}"
fi
done
exit 0
Code:
...
/usr/lib/inet/xntpd [PID: 366]
0.0.0.0(123)
127.0.0.1(123)
192.168.xx.14(123)
192.168.xx.15(123)
...
ZB |
||||
| Google The UNIX and Linux Forums |