Skip to content

Instantly share code, notes, and snippets.

@cybergitt
Created January 1, 2025 05:48
Show Gist options
  • Select an option

  • Save cybergitt/e8558c980e9d2d783d87a07233754dc4 to your computer and use it in GitHub Desktop.

Select an option

Save cybergitt/e8558c980e9d2d783d87a07233754dc4 to your computer and use it in GitHub Desktop.
Ubuntu CLI Rocks

Ubuntu CLI Rocks

List of ubuntu commands

Check Specific 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

or

sudo ss -tuln | grep :80

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

Check Particular 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

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

Check List of Open Ports

Using Netstat or SS

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

or

sudo ss -tuln

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

Using NMAP

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

sudo apt-get install nmap

Then, to scan for open ports, use:

nmap -sT localhost

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

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment