Commands to find opened or closed ports in remote linux box


In this post i am going to explain about how to find a port is opened orĀ  in remote Linux / Unix box.

This may be achieved by using three command prompt tool. They are

  1. telnet,
  2. nmap and
  3. nc.




Using the telnet command we may trace whether the remote machine port is opened or not.
Sample example is given below

[root@client ~]#telnet 443
Connected to (
Escape character is ‘^]’.

If the output is like connected to machine) and in the next line Escape character is ‘^]’ . It clearly tells that 443 is a open port for domain

[root@client ~]# telnet 22
telnet: connect to address Connection timed out

In the above example i am trying to find whether ssh port 22 is opened for machine).
Its showing Trying IP) and connection timed out. It clearly shows that the remote host is not reachable.


Using the nc command also we may trace whether the remote host port is opened or closed.
Sample example is given below.

[root@client ~]# nc -z 80
Connection to 80 port [tcp/http] succeeded!

-z —–> Specifies that nc should just scan for listening daemons, without sending any data to them.


nmap is the best way to find the port check. It shall gives you all the details you are expecting.
Sample example for nmap.

[root@client ~]# nmap -v -A -p 80,443