[colug-432] nc replacement in RHEL7?

Rick Hornsby richardjhornsby at gmail.com
Fri May 29 08:51:23 EDT 2015


> On May 28, 2015, at 16:04, Greg Sidelinger <gate at ilive4code.net> wrote:
> 
> Personally I like to use "echo > /dev/tcp/hostname/port".  I think
> this is a feature of bash.
> 
> $ echo > /dev/tcp/127.0.0.1/80
> $ echo $?
> 0
> $ echo > /dev/tcp/127.0.0.1/90
> -bash: connect: Connection refused
> -bash: /dev/tcp/127.0.0.1/90: Connection refused
> $ echo $?
> 1

That's cool.  Makes total sense (everything in UNIX is a file), but didn't realize this was possible.  I can't use it in this case because I need a short timeout to deal with firewalls that silently drop requests.

Rob's suggestion, socat, defaults to a 0.5 second timeout.

But, I will definitely keep this technique in mind.  There may be some other uses for it.

thanks!




More information about the colug-432 mailing list