title: How can I check Internet access using a Bash script on Linux?
body: <p>In my school, the Internet is not available (every night after 23:00 the school will kill the Internet connection, to put us to bed &gt;..&lt;), Then the ping will never stop, though I have used the parameter <code>ping -w1 ...</code>.</p>
  <p>That is, when I use: <code>ping -q -w1 -c1 8.8.8.8</code> to check if the Internet connection is up/down, it will be there without any output and doesn't exit, just like I am using a single <code>cat</code>.</p>
  <p>I don't know why it's like this, But I think the problem is related to the <em>school-internet-service</em>. Any suggestion? (I think <code>wget</code> may be a good alternative, but how can I use it?)</p>