Live data from Hacker News

The best ping story I've ever heard

askapache.com

11–20 of 49 posts

Re: The best ping story I've ever heard

#12
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

xargs -n1 (-n is so it executes the command for each input)

You'll also need sed -l to limit buffering.

    ping  | sed -l 's/.*/ping/' | xargs -n1 say

Re: The best ping story I've ever heard

#13
Is it just my network administrator or do others drop outgoing Ping messages at the corporate firewall? This has cost me and others more time than I would like to admit for some vague "security" reason that he won't or can't explain.

Re: The best ping story I've ever heard

#16
post #10
post #2

Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.

In a typical UNIX fashion, there's a program that runs programs: ping 127.0.0.1 | sed -e 's/.*/ping/' | xargs -d'\n' -n1 say

-d is a GNU extension, won't work on OSX (short of having installed and running GNU xargs), and it's not needed either in this case.

And `sed -e ` is redundant, `-e` is used to specify multiple commands.

Re: The best ping story I've ever heard

#17
IN particular, that story is about 10Base2, where the topology is not hub-and-spoke but a single cable that snakes from NIC to NIC, with BNC twist-lock connectors and a T-junction at each stop. (And a required termination resistor at the end to stop reflection...)

Re: The best ping story I've ever heard

#18

Is it just my network administrator or do others drop outgoing Ping messages at the corporate firewall? This has cost me and others more time than I would like to admit for some vague "security" reason that he won't or can't explain.

Start with a default-deny policy, the only sensible course. (Google "IP over ICMP".) Note that some sysadmins need to verify external connectivity, so allow ICMP echo reply messages to those IPs (or subnets, more likely).

Result: if your machine isn't in one of those blessed ranges, you never get a response to a ping to an outside address. Most users don't complain, because they don't even know what a ping is.

So, it's not just your company, but it's not general practice everywhere.

Post reply on HN