September 29, 2009

TCP/IP Access Using bash

Most of us default to wget, curl, netcat and others when in need of network data from the commandline, not knowing, or perhaps forgetting, that bash often provides the support that we need using redirection from /dev/proto/host/port.

For example:

  $ cat </dev/tcp/time.nist.gov/13

55103 09-09-29 17:58:55 50 0 0 0.0 UTC(NIST) *

Reads the time in Daytime Protocol (RFC-867) from the NIST Internet Time Service server (documented at tf.nist.gov/service/its.htm)...

 

Article Source Linux Journal
September 29, 2009, 11:23 am
Read More