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:


sudo netstat -tuln | grep :80

bash


or


sudo ss -tuln | grep :80

bash


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:


nc -zv localhost 22

bash


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:


sudo netstat -tuln

bash


or


sudo ss -tuln

bash


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:


sudo apt-get install nmap

bash


Then, to scan for open ports, use:


nmap -sT localhost

bash


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:


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

bash


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 ?