Telnet without Telnet

Monday 18 November 2013

Recently I had to verify the connectivity of a new server. So, I logged in over SSH and simply typed

telnet 5432

to test the firewall rules. But to my suprise, telnet was not installed on that machine.

So, what now?

Ok, we could check if stuff like curl or wget is installed but this won’t help in every case. If you simply want to know if a certain port is open you can use the command:

exec 3> /dev/tcp/;[ $? == "0" ] && echo ok || echo fail

Not as neat as telnet but does the job 🙂