try.directtry.direct

Ubuntu - check open ports

When managing a server running Ubuntu It's essential to know how to check various aspects of your system, such as open ports and SSL certificates. Here’s a guide on how to perform these checks:


Ubuntu Check If Port Is Open


To check if a specific port is open on your Ubuntu server, you can use the `netstat` or `ss` command. For example, to check if port 80 is open, run:


bash
sudo netstat -tuln | grep :80

or


bash
sudo ss -tuln | grep :80

These commands will display information about open ports and listening services.


Ubuntu Check Open Port


If you need to check a particular open port, you can use the `nc` (netcat) command. To check if port 22 is open, use:


bash
nc -zv localhost 22

This will tell you if the port is open and accepting connections.


Ubuntu Check Open Ports


To get a list of all open ports on your Ubuntu server, use the `netstat` or `ss` commands without specifying a port:


bash
sudo netstat -tuln

or


bash
sudo ss -tuln

These commands provide a comprehensive list of all open ports and their associated services.


Ubuntu Check Ports


Another useful tool to check ports on your Ubuntu server is `nmap`. Install `nmap` using:


bash
sudo apt-get install nmap

Then, to scan for open ports, use:


bash
nmap -sT localhost

This will scan and list all open TCP ports on your server.


Ubuntu Check LetsEncrypt Certificate


To check the status and details of your Let's Encrypt certificate on Ubuntu, use the `openssl` command. For example, to check the certificate for a domain, run:


bash
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com

This command will provide details about the SSL certificate, including its validity period and issuer.

By using these commands and tools, you can effectively manage and troubleshoot your Ubuntu server, ensuring that your ports are correctly configured and your SSL certificates are valid.


Have a question ? Join our community discord channel, get help and free consultation!

Need a quick help from the Linux expert ?





Try It Yourself

Deploy this stack or browse pre-built templates in the marketplace. Your first deployment is always free.