Dave's Brain

Browse - computer tips - bash read a tcpip port

Date: 2009sep29
OS: Linux
Language: bash

Q.  Can I use pure bash to read from a TCP/IP port?

A.  Yes, using /dev/tcp
For example:

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

gives

	55105 09-10-01 14:35:59 32 0 0 451.0 UTC(NIST) *

Wow.

Tech Tip: TCP/IP Access Using bash
http://www.linuxjournal.com/content/tech-tip-tcpip-access-using-bash

Everything is a file!
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.