find port greater than 6000


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find port greater than 6000
# 1  
Old 09-03-2009
find port greater than 6000

How to get the listening ports which is greater than 6000 using netstat ?
# 2  
Old 09-03-2009
I'm sure there are easier ways to do this but the following command work in a AIX 5.3

Code:
for port in $(netstat -na | grep LISTEN | awk '{print $4}' | awk -F. '{print $NF}' | sort -n); do if [ $port -gt 6000 ]; then echo $port; fi; done

In AIX unix, nestat -na | grep Listen command shows listen ports like *.7006. In other *nixes (or linux for instance) output may be like 127.0.0.1:7006 so dont forget to adapt the awk part awk '{print $4}' | awk -F. '{print $NF}'

Cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

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

3. Shell Programming and Scripting

Find and substitute if greater than.

I have large config-files for an application. The lines have different structure, but some of them contains the parameter 'TIMEOUT=x', where x is an numeric value. I want to change the value for that specific paramater if the value is greater than a specific value (got that?). The timeout-parameter... (3 Replies)
Discussion started by: useless
3 Replies

4. Shell Programming and Scripting

Help me to find a greater than or smaller than values

Hi, i need to find one of the value from my file is in between two numbers, that is the value is greater than 34 and smaller than 50, Ex: File.txt col1 col2 col3 col4 1 Name1 93 w 2 Name2 94 a 3 Name3 32 b 4 Name4 45 x 5 Name5 50 y 6 Name6 49 z here i need to find col3 values are... (7 Replies)
Discussion started by: Shenbaga.d
7 Replies

5. HP-UX

How to open 6000 port for XDMCP?

Hi, While login to Xmanager its showing " XDMCP connection failed. Try again? " the error attached . (15 Replies)
Discussion started by: purushottamaher
15 Replies

6. Shell Programming and Scripting

find greater than value

Hi I want to find greater than and min value. dategrep() { varlinenum=$1 varSESSTRANS_CL="$(egrep -n "<\/SESSTRANSFORMATIONINST>" tmpsess9580.txt | cut -d":" -f1)" echo $varSESSTRANS_CL } dategrep 8 Output of the above command is: I want to find out greater than 8 and... (9 Replies)
Discussion started by: tmalik79
9 Replies

7. Shell Programming and Scripting

Find image greater than x pixels?

Hi Guys, I have a little problem, was wondering if anyone had any experience with this? I am using imagemagick to remove whitespace from images, however some images are corrupt and the server hangs and eventually crashes because imagemagick doesnt know what to do, even though I have set the... (4 Replies)
Discussion started by: mikemeadeuk
4 Replies

8. Shell Programming and Scripting

Trying to find files equal to and greater than

Hi Guys and Gals, I'm having some difficulty putting this check into a shell script. I would like to search a particular directory for a number of files. The logic I have is pretty simple: Find file named *.txt that are newer than <this file> and count them If the number of files is equal to... (4 Replies)
Discussion started by: bbbngowc
4 Replies

9. AIX

Get CDE/dtlogin to stop listening on port 6000

Hi all, can anyone help me with this? I'm running AIX 5L v5.3 base and installed CDE is 1.0. I've seen recommendations to add "-nolisten tcp" to the args for X but anytime I try that it simply fails to start. I've tried adding it as an arg to /usr/dt/config/Xservers as well as trying to add it... (0 Replies)
Discussion started by: AIXNewbie
0 Replies

10. UNIX for Dummies Questions & Answers

Closing port 6000

Hi I am on solaris 8. And using xdm Xsun for X windows capabilities. Is it possible to close port 6000 and still have xdm Xsun for X windows capabilities. I came across http://www.sunmanagers.org/pipermail/summaries/2004-May/005208.html and neither i can close off port 6000 Rgds (2 Replies)
Discussion started by: yls177
2 Replies
Login or Register to Ask a Question