How to know about open ports and associated applications to it in Linux

Linux-LogoA port is an application-specific or process-specific software construct serving as a communications endpoint and it is identified by its number such as TCP port number 80. In this article we will discuss about Linux Ports. How to find open ports and which process is associated with the ports.

The port numbers are divided into three ranges:

  • Well Known Ports: those from 0 through 1023.
  • Registered Ports: those from 1024 through 49151
  • Dynamic and/or Private Ports: those from 49152 through 65535

Some well known ports are :

Below is the list of some well know ports or default ports.

  • 21: FTP Server
  • 22: SSH Server (remote login)
  • 25: SMTP (mail server)
  • 3306: MySQL (database)
  • 53: Domain Name System (Bind 9 server)
  • 80: World Wide Web (HTTPD server)
  • 110: POP3 mail server
  • 143: IMAP mail server
  • 443: HTTP over Transport Layer Security/Secure Sockets Layer (HTTPDS server)
  • 445: microsoft-ds, Server Message Block over TCP

How to find Open ports ?

In linux we can find which ports are listing. To find out the open ports we can use below command. The out put of the command will give you the information about the open ports.


Some other ways to find out the information about opened ports.


How to find all information about a open port?

If you don’t know which process is associated with port 80/tcp and what is the applicaiton directory the use the below command to find out them.


Now we have the PID of the application which is associated with the opened port 80. Let’s find out the application name.


As per the output of the command Nginx is responsible for the opened port 80/tcp. Let’s find out the current working directory of the process.


Using the above commands now we were able to find the PID, Application Name and Current Working directory of the application of the opened port 80/tcp.

Some useful lsof Commands:


The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply