How to know which ports are in use on Linux

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

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

which ports are in use on Linux
which ports are in use on Linux

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.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook