Skip to content

Checking if a port is open using /dev directory

January 24, 2013

An old but useful tip. You don’t need telnet, nc or other related tool to check if a port is open.

Lets assume you want to check if the port 22 is open at host 192.168.0.2, perform it:

# echo > /dev/tcp/192.168.0.2/22

Check the return code of the command above

# echo $?
0

If “0”, port is open, if “1” the port is closed.

That’s all.

; )

From → Linux

2 Comments
  1. galco permalink

    what command can use I check all port?

Leave a reply to galco Cancel reply