Hello, friends. In this post, you will learn how to know which ports are in use on Linux. This as a sysadmin can be easy, but it can always help to solve a problem or two.
Introduction
If we have a server or a personal computer running various services, they usually tend to use a specific port. But it could be the case of having several and not remembering which one exactly is the one that is running. Another option is that these ports are used by applications that should be running but are not.
For these cases, it is good to know which ports are active or in use. This way, you can quickly find out if the application you installed or the associated service is running.
How to check ports active or in use on Linux
The procedure is effortless. First open a terminal or, if you are on a server, connect via SSH to it.
As I always advise, update the whole system
sudo apt update
sudo apt upgrade
Now you can achieve the goal by using the netstat command, which is a tool for basic scanning of network interfaces.
In short, the command that shows the ports in use is:
sudo netstat -ltup
You will get an output screen like this
Another option is to use the ss command. It does basically the same thing, but in a different way.
sudo ss -lntu
This is how easy it is to get the ports that are in use.
Conclusion
Learning about ports on Linux is something simple but can be the basis of daily work. Today, is a sample of it.