The good news is that you don’t need telnet, because most Linux distributions already include tools that can test port connectivity, and some require no additional installation at all.
Whether you’re troubleshooting a MySQL connection, checking if Nginx is listening on port 443, or verifying that a firewall change worked as expected, these tools can quickly tell you what’s happening.
For many years, telnet was the standard way to check whether a port was open and accepting connections.
If you wanted to see whether a web server, database, or mail service was reachable, telnet was usually the first command people tried.
Things have changed, though and most modern Linux distributions no longer install telnet by default, especially on minimal server deployments.
If you run the command today, you’ll often see a simple command not found message.
Even if it is available, telnet isn’t always the most useful troubleshooting tool.
It can tell you whether a connection succeeds, but it provides very little information beyond that.
Fortunately, Linux offers several better alternatives.
Some are already installed on most systems, while others can be added with a single package install.
These tools not only test connectivity but can also provide clearer error messages, connection details, and faster troubleshooting when something isn’t working as expected.
In the following sections, we’ll look at the most practical ways to test ports on a Linux system without relying on telnet.
If you’re working on a minimal Linux server and just need a quick answer to “Is this port reachable?“, Bash has a built-in feature that can help.
It provides a special pseudo-device called /dev/tcp that allows you to open a TCP connection directly from the shell without installing any additional tools.
Run the following command:
If the connection succeeds, you’ll see:
If the port is blocked, closed, or unreachable, you’ll see:
In this example, the command attempts to connect to port 80 on 192.168.1.10, which is especially useful when you’re logged into a remote server that doesn’t have tools like telnet, nc, or nmap installed.
For example, to test whether an HTTPS service is reachable on a remote website, run:
The /dev/tcp feature is available only in Bash.
If your script is running under sh, dash, or another shell, the command will fail even though the /dev/tcp path appears to exist.
If you’re unsure which shell is being used, explicitly run the test through Bash:
While /dev/tcp doesn’t provide detailed troubleshooting information, it’s one of the quickest ways to verify whether a TCP port is accepting connections, making it perfect for quick checks on lightweight or freshly deployed servers.
If /dev/tcp feels a little too basic, nc (Netcat) is usually the next tool administrators reach for, which is lightweight, easy to use, and provides more useful feedback when you’re troubleshooting network connections.
Netcat is often called the “Swiss Army knife” of networking because it can do everything from testing ports to transferring data between systems.
To check whether a port is open, use the -z (zero-I/O) option:
Example output:
The command uses two important flags:
Unlike telnet, which simply connects and leaves you staring at a blank screen, Netcat immediately tells you whether the connection succeeded or failed.
Let’s test a port where no service is running:
Example output:
A Connection refused message is actually useful information.
Many Linux distributions already include Netcat, but some minimal server installations do not.
Once installed, nc becomes one of the most useful troubleshooting tools you’ll have on any Linux server.
When you need more than a simple “open” or “closed” answer, nmap is the tool to use, as it is one of the most popular network scanning tools and is widely used by system administrators, network engineers, and security professionals.
Unlike nc or the Bash /dev/tcp method, nmap can identify services, detect filtered ports, and provide a much clearer picture of what’s happening on a remote system.
If nmap isn’t already installed, you can add it using your package manager.
To check whether port 80 is open on a server, run:
Example output:
The most important column here is STATE:
You can also scan a range of ports in a single command:
Example output:
One of Nmap’s most useful features is version detection, simply add the -sV option and Nmap will attempt to identify the software running behind an open port.
Instead of simply reporting that port 22 is open, Nmap may identify the SSH server version and other service details.
When you’re troubleshooting a web server, simply knowing that a port is open isn’t always enough.
A port can accept connections while the web application behind it is returning errors, serving the wrong content, or failing completely.
That’s where curl becomes useful.
Unlike nc or /dev/tcp, curl doesn’t just test the TCP connection.
It actually sends an HTTP request and shows you how the web server responds, which makes it one of the best tools for checking ports 80 (HTTP) and 443 (HTTPS).
To test a web server listening on port 80, run:
Example output:
To check a secure web server on port 443, use:
If the HTTPS service is working correctly, you’ll see SSL negotiation details followed by the HTTP response headers.
If you need to check ports from a script, Python is a great option and most of the Linux distributions already include, and its built-in socket module makes port testing straightforward.
This approach is especially useful when you’re building health checks, deployment validation scripts, or simple monitoring tools.
To test a single port, run:
Example output:
In this example, Python attempts to connect to port 5432, which is commonly used by PostgreSQL.
A few things are happening behind the scenes:
In real environments, you often need to verify several services after a deployment.
For example, you may want to confirm that SSH, HTTP, and MySQL are all reachable.
The following script checks multiple host and port combinations:
Example output:
This loops through a list of host/port pairs and prints the status of each one, which is exactly what you want for a pre-deployment checklist or a simple uptime check in a cron job.
Here’s a quick reference for picking the right tool:
There are several easy ways to test port connectivity on Linux without using telnet.
To see these tools in action, try testing a service running on your own system.
For example, if SSH is enabled, you can check port 22 with:
You should see a successful connection almost immediately.
Then test a port that has no service listening on it and compare the results.
This is a simple way to understand the difference between an open port, a refused connection, and a filtered port.
Have you run into a case where one of these tools gave you a different result than another? That’s usually a sign that a firewall is involved in a non-obvious way.
Drop what you saw in the comments and let’s work through it.
How to Downgrade and Lock Packages With dnf in RHEL Systems
How to Resize ext4 Partitions and Filesystems in Linux
at Command: Schedule One-Time Linux Tasks Without Cron
20 Must-Know Linux Commands for System Administrators
How to Stop Linux Processes from Using Excessive CPU and RAM
Create a Chat Server in Linux and 5 Other Terminal Tricks
How to Add Linux Host to Nagios Monitoring Server Using NRPE Plugin
How to Setup Rsyslog Client to Send Logs to Rsyslog Server in CentOS 7
How to Monitor Node.js Applications Using PM2 Web Dashboard
How to Monitor Linux Server Security with Osquery
6 Open Source Tools to Monitor MySQL Performance in Linux
Cockpit – A Powerful Tool to Monitor and Administer Multiple Linux Servers via Browser
How to Create Hard and Symbolic Links in Linux
How To Create A File In Linux: Echo, Touch, Tee and Cat Commands
How to Move Files and Folders with Spaces on Linux
10 Useful Chaining Operators in Linux with Practical Examples
Different Ways to Create and Use Bash Aliases in Linux
TLDR – Simplifying Linux Commands with User-Friendly Man Pages
Top 5 Open-Source OCR Tools for Linux in 2025
4 Best QR Code Generator Tools for Linux
5 Must-Try AI Tools for Linux Users in 2026
13 Most Used Microsoft Office Alternatives for Linux
5 Best PDF to Word Converters for Linux
4 Best Twitter Clients for Linux in 2024 (Updated)
—
**📚 Original Source:**
[5 Ways to Check Remote Port Connectivity in Linux](https://www.tecmint.com/check-open-ports-linux-without-telnet/)
