Sponsored Content
Operating Systems Solaris list service with port number Post 302353709 by sharkux on Wednesday 16th of September 2009 02:46:12 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
services(4)						     Kernel Interfaces Manual						       services(4)

NAME
services - Defines the sockets and protocols used for Internet services SYNOPSIS
/etc/services DESCRIPTION
The /etc/services file associates Internet service names and aliases with the port number and protocol used by the service. Each service is listed in this file on a single line of the form: ServiceName PortNumber/ProtocolName Aliases The fields contain the following information: The official Internet service name. The socket port number used for the service and the transport protocol used for the service. A list of unofficial service names. Items on a line are separated by spaces or tabs. Comments begin with a # (number sign) and continue to the end of the line. EXAMPLES
Entries in the /etc/services file for the inetd internal services might look like this: echo 7/tcp echo 7/udp discard 9/tcp sink null discard 9/udp sink null daytime 13/tcp daytime 13/udp chargen 19/tcp ttytst source chargen 19/tcp ttytst source ftp 21/tcp time 37/tcp timeserver time 37/udp timeserver RELATED INFORMATION
Functions: endservent(3), getservbyname(3), getservbyport(3), getservent(3), setservent(3) The RFC923 specification. delim off services(4)
All times are GMT -4. The time now is 08:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy