on
Reading time: 1 minute
Network in the Shell
It’s a nifty small feature in the bash shell that i start to love quite a time ago when i just wanted to check some networking stuff from the shell. It’s the network pseudo device in the bash shell. Not every bash shell executable is compiled with this feature, however i tested this with Solaris 11.3. Let’s assume you want to find out if a port is open on a system, you could simply do this with bash build-in commands.
You just use the device with the following sequence like a position in your filesystem /dev/tcp/hostname/portnumber
. There is a similar device for UDP obviously called /dev/udp
. It gets really cool when you can use it to download a file to your system with it. I created a shell script like this:
This script should work on other systems using bash as well. Just remove the g of gsed. Now start the script.