Redirection to network addresses

suggest change

Bash treats some paths as special and can do some network communication by writing to /dev/{udp|tcp}/host/port. Bash cannot setup a listening server, but can initiate a connection, and for TCP can read the results at least.

For example, to send a simple web request one could do:

exec 3</dev/tcp/
printf 'GET / HTTP/1.0\r\n\r\n' >&3
cat <&3

and the results of’s default web page will be printed to stdout.


printf 'HI\n' >/dev/udp/

would send a UDP message containing HI\n to a listener on

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents