Everytime You Run Bash It Will Run And Send The Command To Background In A Loop Forever. This Is Useful In Android To Avoid Getting Discconnected While Using ADB Or Other Services Like SSH By Being Inactive For Long Periods Of Time. In My Case I Get Bash Full Suport Only Through ADB And Also A Decent Python Interpreter Using Python For Android.
I run into regular problems whereby my cable modem from my ISP will simply stop working. To ensure that it is a problem with my cable modem (and not the router in-between my machine and the cable modem), I needed a quick way to test to someplace beyond the cable modem. The place shouldn't be beyond the cable network though. As such, I needed to determine the gateway to which my cable modem was connected. Since my router cannot do this on it's own... I created a single line command that will ping the gateway IP address based upon knowing that my gateway will be my second hop (after my wifi router), tracerouting for 2 hops, pulling the last line of the traceroute output and grep'ing for just the IP address. To stop pinging, use . This works on linux and osx and, with the addition of cygwin tools or the win-gnu project... should work on windows as well. Show Sample Output
Changelog: Changing ping to "ping -A -c1 -w10" - targeting a quick and reliable ping, even on slow networks.
In the vein of "can you do it better", here is my take on using "ping" to emulate sleep in a DOS/BAT script. If one can use ping at all then the multicast address will be valid but will not respond. By doing only one ping (-n 1) and setting a timeout in milliseconds (-w 10000) you have a fairly accurate timer. This example gives about a 10 second sleep.
Does one ping to a URL or host, and echo out just the response time. I use this on, with MRTG to monitor the connections to various hosts. Show Sample Output
A simple way to find all machines on a network subnet is pinging a broadcast address (-b flag). First run ifconfig ifconfig. Then use "Bcast" address and '-b' flag in ping Show Sample Output
If you need to ssh into a computer on the local network but you're unsure of the ip to use, then ping them and see if you get a response. If you do, print out the address you got it from. Adjust the range to suit your network.
Not really an easier solution. But an example using && for (if last command returned 0). You can use || for (if last command returned other than 0).. Show Sample Output
Every 20 minutes ping host with IP address 192.168.0.14. If it's not 'alive' or not reachable, then display something eye-catching (here xeyes) on the desktop.
Hint for newbies: edit crontab with
crontab -e
sending packet by ping if sending more high packet root needed... Show Sample Output
On Linux and Mac systems (I have not tested with other Unix systems), the ping command will keep on pinging until the user interrupts it with Ctrl+C. On Windows system, ping will execute for a number of times then quit. The -c flag on Linux and Mac will make this happen
Quick and dirty one-liner to get the average ping(1) time from a server. Show Sample Output
Every 20 minutes test if host with IP 192.168.0.14 is 'dead' or not reachable. The line should be put in your crontab file.
Say you need to ping every 5th IP address on your network .. this will give you a way of doing that.
jot can also do counting ... like
jot 4
1
2
3
4
download from http://oreilly.com/catalog/upt2/examples/#jot or fins athena-jot in rpm format
Show Sample Output
documents all active ips on a subnet and saves to txt file. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: