Get Used Port List


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get Used Port List
# 1  
Old 11-01-2010
Get Used Port List

Hi All-

How to get used port list in UNIX?

Thanks,
Mani Muthu
# 2  
Old 11-01-2010
What is a "Used Port List"?
Can you give an example?
# 3  
Old 11-01-2010
You would be best to look at the output from netstat (and the man pages) and also a read through /etc/services for registered ports on your server.



Does that help?





Robin
This User Gave Thanks to rbatte1 For This Post:
# 4  
Old 11-01-2010
Thanks Robin,
I am using 'netstat -an'
# 5  
Old 11-01-2010
Glad it helped, but I must wonder why you're looking. Not that I need to know, but if there is a good reason to be trying to trace where things are coming in from, there is a free tool called lsof (originally LiSt Open Files) that is good for this sort of thing. See
HTML Code:
http://uk.ask.com/wiki/Lsof
for a pointer on that.

I have used it when I have found a remote oracle process chewing up CPU. The first thing I would do is
Code:
lsof -o -p $suspect_process

... and it lists out the open files and TCP/IP ports. You can see (like netstat output) where the other end of the connection is. That helped track many things down, but some were started on the local machine but directed as thgouh they were remote, so the next trick was (knowning the oracle port was 1521)
Code:
lsof -i tcp:$source_port

and putting in the opposing port to 1521. That would return the process I started with and the source process of the TCP connection. it may be an iterative process, but it's great for tracing. Of course, it's real-time, so if the connection closes before you finish, you lose it.





Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script, find the next closed (not in use) port from some port range.

hi, i would like to create a bash script that check which port in my Linux server are closed (not in use) from a specific range, port range (3000-3010). the print output need to be only 1 port, and it will be nice if the output will be saved as a variable or in same file. my code is: ... (2 Replies)
Discussion started by: yossi
2 Replies

2. Shell Programming and Scripting

IP list specific port checker script

Hello again people, I currently searching for a code/script that will allow it to check if a specific port is open, lets say 123. Found a public script on a ftp but I dont know how and what to modify in it to suit my needs. (I think this is a evil code and I want to use it as an example). ... (3 Replies)
Discussion started by: galford
3 Replies

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

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

5. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

6. Solaris

How to enable Serial port on ILOM, when Network Port is enabled in parallel

Hi Everyone, In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 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. UNIX for Advanced & Expert Users

How to list process connected to tcp port?

Hey guys, I need to kill the process that is currently connected to port 10540. I'm on HP-UX machine. Below is the result of my netstat. $ netstat -an |grep 10540 tcp 0 0 129.0.0.1.10540 *.* LISTEN We don't have lsof command, but we have fuser. ... (3 Replies)
Discussion started by: brichigo
3 Replies

9. Solaris

list service with port number

Hi all, I want to list all service is running now with the specific port number (5 Replies)
Discussion started by: sharkux
5 Replies
Login or Register to Ask a Question