In this article, we will explain how to scan open ports on a remote server in Linux.
With Linux, we can identify which services or ports are open on the remote server and whether they are accessible. It helps in troubleshooting connectivity issues, verifying firewall rules, and maintaining server security.
Linux offers multiple tools to perform port scans successfully.
Table of Contents
Why Scan Open Ports?
Port scanning helps you:
- Verify which services are open and accessible.
- Identify misconfigurations and security vulnerabilities.
- Troubleshoot connection issues.
- Confirm firewall rules are working correctly.
Scanning open ports using nmap
‘nmap’ (Network Mapper) is the most popular tool for network discovery and port scanning.
- Install nmap (if not already installed):
sudo apt install nmap # On Ubuntu/Debian sudo yum install nmap # On CentOS/RHEL
- To scan the basic port, use the command below:
nmap <remote-server-ip>
- To scan a specific port range, execute the following:
nmap -p 20-100 <remote-server-ip>
- To scan for service and version detection, use the following command:
nmap -sV <remote-server-ip>
Scanning ports using netcat (nc)
‘netcat’ is a multipurpose networking tool that can also be used to check for open ports.
- To check a single port, run the following:
nc -zv <remote-server-ip> 22
- To scan a range of ports, use the subsequent command, and you can mention the range as given below:
nc -zv <remote-server-ip> 20-100
Scanning ports using ss or telnet
‘ss’ or ‘telnet’ can be used for quick checks without installing extra tools:
- Using telnet (for a single port):
telnet <remote-server-ip> 80
If the connection succeeds, the port is open.
- Example command for ss (optional):
ss -tn 'sport = :80'
Example Output (Nmap)
Starting Nmap 7.93 ( https://nmap.org ) at 2025-09-03 Nmap scan report for 192.168.1.10 Host is up (0.0020s latency). Not shown: 996 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https
Security Considerations
The following security factors should be considered:
- Always scan with authorisation to avoid breaching security policies.
- Use these scans often to check for unintentional open ports and close unnecessary ones.
- Combine port scanning with firewall configuration (ufw, firewalld, iptables) for stronger protection.
This way, you can scan open ports on a remote server in Linux using tools like ‘nmap’, ‘netcat’, or ‘telnet’. Among these, ‘nmap’ provides the most detailed and useful results. Regular scans help improve server security and troubleshooting. For more such informative articles, do visit our KB section regularly.
A Linux VPS Hosting solution gives you the control needed to manage network services, secure exposed ports and maintain a reliable server environment.
Scanning server ports done? Learn How to scan your email and website for viruses using cPanel