Operating System - Linux
1747993 Members
5060 Online
108756 Solutions
New Discussion юеВ

Re: how to view the running application in particular ports

 
SOLVED
Go to solution
senthil_kumar_1
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
Ivan Ferreira
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?
Steven E. Protter
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
senthil_kumar_1
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.
Steven Schweda
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.
Sivakumar MJ._1
Respected Contributor

Re: how to view the running application in particular ports

Heironimus
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.
Steven E. Protter
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
Autocross.US
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.