AIX - Ports in use and how to check them

Posted on 2012-09-07
Medium Priority
Last Modified: 2012-09-10
I have two issues below that I need help with.

First, I have an  example port receiving details that it is in use or blocked. How do I check to see what is using this port?

servername:/> netstat | grep -v grep | grep 201

udp4       0      0  servername.201    *.*

Second, I have an application that uses ports 1911-1919. These are application specific ports. How do I check what is using them and how to free up the ports?

servername:/> netstat -an | grep .191
tcp        0      0  1X.2XX.XXX.XX.9638    XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9639     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9640     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp        0      0  1X.2XX.XXX.XX.9641     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp4       0      0  1X.2XX.XXX.XX.9642     XX.XXX.XXX.XX.1913    ESTABLISHED
tcp4       0      0  *.1911                *.*                    LISTEN
tcp4       0      0  *.1912                *.*                    LISTEN
tcp4       0      0  *.1914                *.*                    LISTEN
tcp4       0      0  *.1913                *.*                    LISTEN
Question by:AIX25
LVL 40

Assisted Solution

omarfarid earned 1000 total points
ID: 38377972
LVL 68

Accepted Solution

woolmilkporc earned 1000 total points
ID: 38378016
And if you don't want to (or can't) use lsof:

1) Issue

netstat -Aan | grep <portno>

2) Use the address displayed in the first column (the PCB = protocol control block) to issue:

rmsock <pcb_address> tcpcb

Example for port 13 (inetd):

netstat -Aan | grep "*.13 "
f100060001814b98 tcp4       0      0  *.13               *.*                LISTEN

rmsock f100060001814b98 tcpcb
The socket 0x1814808 is being held by proccess 131162 (inetd).

Freeing up ports is only possible by killing the processes which use them.

Author Comment

ID: 38384009
I used both methods and both worked properly.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question