System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to view the running application in particular ports

 
SOLVED
Go to solution
Highlighted
Super Advisor

how to view the running application in particular ports

Hi

I am using Redhat linux. in that following ports are open 25,110,143,80,443.

I know that these ports for smtp,pop3,imap,http and https.

But I want to software name like sendmail / postfix and apache or any other we server.

So i want to know the exact application name running in particular ports.
8 REPLIES 8
Highlighted
Honored Contributor

Re: how to view the running application in particular ports

Use:

lsof -i :

# lsof -i :22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 4855 root 3u IPv6 10866 TCP *:ssh (LISTEN)
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Highlighted
Exalted Contributor

Re: how to view the running application in particular ports

Shalom,

I would want to know what is listening.

netstat -an | grep port_number

Then use lsof to get information on the process.

lsof -i 25
# May show multiple sendmail connections.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Highlighted
Super Advisor

Re: how to view the running application in particular ports

Hi

The command "isof" is not found in my
system.

How to install this.
Highlighted
Honored Contributor

Re: how to view the running application in particular ports

> The command "isof" is not found in my
> system.

Nor on anyone else's. "lsof". LSOF <> ISOF.
Highlighted
Respected Contributor

Re: how to view the running application in particular ports

Senthil,

Check this...

http://www.opensource.apple.com/darwinsource/10.3/lsof-12/lsof/00QUICKSTART
For HP Online Case Logging-->http://support.openview.hp.com/
Highlighted
Honored Contributor

Re: how to view the running application in particular ports

On Linux root can also use the "-p" option to have netstat display the process associated with a port.
Highlighted
Exalted Contributor

Re: how to view the running application in particular ports

Shalom,


It is standard install on RHEL.

/usr/sbin/lsof

rpm -qf /usr/sbin/lsof
lsof-4.78-3

This is off a RHEL 5.3 system.

That is the package you want to install.

-qf runs a query and asks what package provides the binary.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Highlighted
Trusted Contributor
Solution

Re: how to view the running application in particular ports

Run netstat with the following options to show all listening ports with the software name/PID:

netstat -tunlp

You can use grep to narrow it down:

netstat -tunlp|grep ":21" port 21)

I drive way too fast to worry about calories.