Script needed to see the ports being used by the Aix server.

LindaC
LindaC used Ask the Experts™
on
I'am expecting something like this:

"Run this script as root so that you will have in a text file, the ports that are being used"
After you add the proper comments to this text file  adding this to each line (example)
    # Comment-This port is for Oracle Apex
then you run this  other script to add the content of this text file to the /etc/services.
This must be run by root.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007

Commented:
you may look at the output of command like

netstat -an

can you elaborate on the requirement?

Author

Commented:
It will suffice if I can get a text file with all the ports that are in use on the server.
The other ports that are not in the text files will be closed.

Author

Commented:
Only the text files with the ports that are being used.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Most Valuable Expert 2013
Top Expert 2013
Commented:
Ok, your question looked way more complicated than what you're asking for in your last comment.

Try this:

netstat -an | egrep "^tcp|^udp" | awk '{print $4}' | awk -F '.'  '{print $NF}' > open_ports_list.txt
Top Expert 2007

Commented:
try this

netstat -an | egrep -i "list|estab|connect" > file

this should give you idea about ports used on the system

Author

Commented:
Does this udp means that they are being used?

udp        0      0  *.46656                *.*
claropr-oem-oracle:/oracle/diag/rdbms/oem11g/oem11g/trace> an|grep 14253
udp        0      0  *.14253                *.*
ports-used.bmp
Most Valuable Expert 2013
Top Expert 2013

Commented:
udp is the protocol being used (User Datagram Protocol)

The simple fact that the port appears in the output of "netstat -an" means that it's open and in use.

Author

Commented:
Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial