DropVPS Team
Writer: Cooper Reagan
How to Check What is Running on a Port in Linux?

Table of Contents
What you will read?
When managing a server or a system, knowing what services are running on which ports can be crucial for troubleshooting, security, and performance optimization. In this article, we’ll explore various methods to check what is running on a specific port in Linux.
Using the netstat Command
One of the most common tools for checking network connections in Linux is netstat. You can use it to display all ports and their corresponding services.
To see what is running on all ports, you can use:
netstat -tuln
-t: Show TCP ports-u: Show UDP ports-l: Show only listening ports-n: Show numerical addresses instead of resolving hostnames
If you want to filter the results to find a specific port, you can combine it with grep. For example, to check what is running on port 80:
netstat -tuln | grep :80
Using the ss Command
The ss command is a modern alternative to netstat and provides a more detailed output. To view all listening ports, run:
ss -tuln
Similar to netstat, you can filter for a specific port:
ss -tuln | grep :80
Using lsof
lsof (List Open Files) is another powerful tool that can be used to check which process is using a specific port. To find out what is running on port 80, you can execute:
lsof -i :80
This command will show you the command name, PID, user, and the network details for the process using port 80.
Using fuser
The fuser command identifies processes using files or sockets. To check which process is using port 80, you can run:
fuser 80/tcp
If you want to see the process details, you can add the -v option:
fuser -v 80/tcp
Using nmap
If you want to scan for open ports and see what services are running on them, nmap is a powerful network scanning tool. You can use it like this:
nmap -sV -p 80 localhost
-sV: Attempts to determine the version of the service running on the port-p: Specifies the port to scan
Conclusion
Knowing how to check what is running on a port in Linux is an essential skill for system administrators and developers alike. By using tools like netstat, ss, lsof, fuser, and nmap, you can effectively monitor and manage the services on your system. For more tips and tricks on managing your Linux server, stay tuned to our blog at dropvps.com. Happy networking!