How to check if the port is open on the other side in Linux?
You can use telnet, nc (netcat), or nmap to check if the ports of a remote host are open.
- Utilize the telnet command:
Telnet is a network protocol that allows for interactive text-based communication between remote hosts. You can use the following command to check if a port is open on a remote host:
telnet <host> <port>
For example, to check if port 80 is open on the remote host 192.168.1.100, you can execute the following command:
telnet 192.168.1.100 80
If the port is open, you will see a message indicating successful connection; otherwise, a message indicating connection failure will be displayed.
- Utilize the nc (netcat) command:
Netcat (nc) is a command line tool used for handling TCP and UDP connections. You can use the following command to check if a port on a remote host is open:
nc -z <host> <port>
For example, to check if port 80 is open on the remote host 192.168.1.100, you can execute the following command:
nc -z 192.168.1.100 80
If the port is open, no output will be displayed; otherwise, a message indicating connection failure will be shown.
- Utilize the nmap command:
nmap is a network scanning tool that can assist you in checking the port status of remote hosts. You can use the following command to scan the ports of remote hosts:
nmap <host>
For example, to scan the port status on the remote host 192.168.1.100, you can execute the following command:
nmap 192.168.1.100
nmap displays the port status of remote hosts (open, closed, or filtered).
Please be aware that you may need to install telnet, nc, or nmap tools in the system in order to execute the commands above.
More tutorials
How can Linux detect if a remote host’s port is open?(Opens in a new browser tab)
Using Telnet Commands in Linux/Unix(Opens in a new browser tab)
How can you check open ports in CentOS?(Opens in a new browser tab)
Remote Desktop Protocol on Ubuntu 22.04 by utilizing xrdp.(Opens in a new browser tab)
Primefaces’ Message, Messages, and Growl components(Opens in a new browser tab)