Operating System - HP-UX
1748140 Members
3641 Online
108758 Solutions
New Discussion юеВ

Re: How to view the all opened ports and applications in hpux

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

How to view the all opened ports and applications in hpux

Hi

I am using hpux 11.00 and 11.11.

I want to view all the opened ports and what are the applications are using that port?

In linux i can use "netstat" command with following options. but it is not working in hpux.

THESE COMMANDS ARE WORKING FOR LINUX VERY WELL.



To view that port / service (pop3 or smtp) / application (email or sendmail) are opened:

1) # netstat -na | grep :25 ---> to view port number only

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN


n --> port number
a --> all (LISTEN & ESTABLISHED)

2) # netstat -tulpn | grep :25 | more --> to view with application name and LISTEN (OPENED ONLY)

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 23478/email



3) #netstat -tulpna | grep :25 | more ---> to view with application name and LISTEN & ESTABLISHED


tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 23478/sendmail
tcp 0 0 127.0.0.1:62359 127.0.0.1:25251 ESTABLISHED 23478/sendmail



t-->tcp
u-->udp
l -->loopback (localhost)
p-->process name (application name)
n-->port number
a-->all (LISTEN & ESTABLISHED)


4) To view by service name (smtp or pop):

# netstat -a | grep smtp

tcp 0 0 *:smtp *:* LISTEN


Pls find the attachment for clear report
7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: How to view the all opened ports and applications in hpux

>>but it is not working in hpux.

What is it that isn't working?

Have checked the netstat man page on your HP-UX servers to see what the command line options are?

Remember, HP-UX is NOT Linux!

If you want a cross-platform solution that **SHOULD** work almost the same in both Linux and HP-UX, use 'lsof'. You will have to load lsof on your HP-UX servers yourself, but it is available if you search for it.
johnsonpk
Honored Contributor
Solution

Re: How to view the all opened ports and applications in hpux

Hi Senthil,

Try lsof -i tcp |grep

rgds
Johnson
Nido
Trusted Contributor

Re: How to view the all opened ports and applications in hpux

Hi,

Use `lsof` to get the details on which port application is running.

Check the `man lsof` page for Details, There are examples included in the bottom of the man page.

eg. lsof -i tcp/udp

Thanks,
" Let Villagers Be Happy!! "
Arun Vijay V C
Frequent Advisor

Re: How to view the all opened ports and applications in hpux

Hi Senthil,
netstat is a common HP UX command all Unix flavours, it should work in HP UNIX also.

#netstat -a |grep "Port No"

for a detailed report on the opened port, you can use LSOF that you need to install separately if you dont find in the server.

/usr/sbin/lsof -i tcp |grep "port No"

Reffer the thread for LSOF download and installation,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=187859

also,
http://www.cmve.net/~merijn/

Regards,
Arun....
Tirtha
Occasional Advisor

Re: How to view the all opened ports and applications in hpux

Hi..

To check all the application running in the system at that time
#ps -ef | grep

I think it will help you..

You can also check /etc/services to know about ports..
Suraj K Sankari
Honored Contributor

Re: How to view the all opened ports and applications in hpux

Hi Senthil,

Like linux, HP unix also having the same command to check open ports.
used netstat -a | grep "port no"
or netstat -a | grep -i ESTABLISHED
same thing you can get with lsof command
if lsof is not installed in your server then download from this below link install it, read the man page of lsof.

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.82/

Suraj
Jeeshan
Honored Contributor

Re: How to view the all opened ports and applications in hpux

yeah like others says, lsof is a very good tool.

you can either check with nmap also.
a warrior never quits