nc missing option -z

Cameron Simpson cs at zip.com.au
Wed Feb 13 03:40:42 UTC 2013


On 13Feb2013 03:21, Suvayu Ali <fatkasuvayu+linux at gmail.com> wrote:
| I used to use netcat to check if a particular host is up or if I have
| internet connection before I run a few scripts. [...]
| Any ideas what happened to it?  What can I use as replacement?

If I want to know if I have an internet connection I look for a default
route in the output of "netstat -an", thus:

  netstat -rn | egrep '\''^(default|0\.0\.0\.0) +[1-9]'\'' >/dev/null

No default route - no general purpose internet connection.
A default route but no connectivity? Then something else is wrong that
needs fixing anyway.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

We _like_ the starter!  Wouldn't have it any other way.  If it doesn't grind,
take it back to the dealer and make them fix it!
        - Jon N. Steiger, DoD#1038, <stei0302 at mary.cs.fredonia.edu>


More information about the users mailing list