list service with port number


 
Thread Tools Search this Thread
Operating Systems Solaris list service with port number
# 1  
Old 09-15-2009
list service with port number

Hi all,
I want to list all service is running now with the specific port number
# 2  
Old 09-15-2009
"netstat" should be your friend...
# 3  
Old 09-15-2009
Code:
#netstat   -an
#netstat   -an   |    grep    service

# 4  
Old 09-16-2009
very thanks for your support
but i want to list all service that already running and its port
not a specific service
i guess netstat don't do that
after my searching i found script do that
***********************************************
#!/bin/ksh

line='---------------------------------------------'
pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}')

if [ $# -eq 0 ]; then
read ans?"Enter port you would like to know pid for: "
else
ans=$1
fi

for f in $pids
do
/usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
if [ $? -eq 0 ]; then
echo $line
echo "Port: $ans is being used by PID:\c"
/usr/bin/ps -ef -o pid -o args | egrep -v "grep|pfiles" | grep $f
fi
done
exit 0
***********************************************
but you should give the port number to this script
if i don't know the port number and i want to make a port scan for all port that already open and matched with particular service
so is there any command do this or not
# 5  
Old 09-21-2009
Quote:
Originally Posted by sharkux
Hi all,
I want to list all service is running now with the specific port number
Script whohassocket -very usefull tool

Tool for list processes and ports in Solaris
# 6  
Old 09-24-2009
hi ikorolev
very thanks this is a wonder fill script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

NAGIOS Service not able to open port on AIX 7.1

I have an AIX 7.1 LPAR where Nagios agent was installed for monitoring. The issue is that when I start the nagios service (ncpa_listener), it starts but does not open the 5693 port it requires for communication. On all other LPARs the service opens the port and is listening. I tried reinstalling... (4 Replies)
Discussion started by: wibhore
4 Replies

2. UNIX for Beginners Questions & Answers

Ping the service with out port number

I got the service status through nc on remote network but 2 services doesn't have port number.how to get the other 2 services status with out port number .pls provide the solution to me. (1 Reply)
Discussion started by: userexperience
1 Replies

3. Shell Programming and Scripting

Ping the service with out port number on remote network

I got the service status through nc on remote network but 2 services doesn't have port number.how to get the other 2 services status with out port number .pls provide the solution to me. I need to develop with is in a script (2 Replies)
Discussion started by: kannansoft1985
2 Replies

4. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

5. Solaris

Cabling and adapters to communicate to service processor serial port from Windows PC with USB port.

Hello, I have an unloaded T5140 machine and want to access the ILOM for the first time and subsequently the network port after that., and then load Solaris 10 the final January 2011 build. The first part is what confuses me -the cabling. I am coming from a Windows machine (w/appropriate... (5 Replies)
Discussion started by: joboy
5 Replies

6. Programming

Using Different port for Daytime Service

Hi all, is it possible to use a different port number for daytime service. By default the port number of daytime service is 13, so what if I want to get the time from a different port number e.g say 9000 (or any other port). I guess this would remain the same on the server side !... (2 Replies)
Discussion started by: manisum
2 Replies

7. Shell Programming and Scripting

To get Port number alone from the list

~]#netstat -vatn | grep LISTEN tcp 0 0 0.0.0.0:34895 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN ... (7 Replies)
Discussion started by: linuxadmin
7 Replies

8. AIX

Finding service based on port number

is it possible to find out which Service is running on the basis of port no which is open/listening? Regards Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

9. UNIX for Dummies Questions & Answers

port number

hi all i want to connect a system, how can i know the port number of a system. (2 Replies)
Discussion started by: tukuna82
2 Replies

10. Cybersecurity

get number of a port

Hello every one. I work in a LAN with many application server. Each one use a different port. What command permit to obtain the number of these port. thanks (2 Replies)
Discussion started by: hoang
2 Replies
Login or Register to Ask a Question