bash, /dev/net and you

found during a random goog search on Dave Smith’s Blog:

exec 3<>/dev/tcp/
echo -e "GET / HTTP/1.1\n\n" >&3
cat <&3

seriously, wrap your head around that. /dev/net isn't a real device, it's a magical pseudodevice that bash intercepts and opens a socket as requested.


  • kale

    September 14, 2012

    it’s been pointed out to me that this is in the man page for bash. but seriously, who actually rtfm’s?

  • Raghu

    January 28, 2013

    See — I found out about this in some Linux-From-Scratch web site or another

  • Chris

    February 12, 2013

    Haha. Blocked by the web gateway. But I ran it from another server. Muwahahahaha.

Leave a Reply