This allows for sleeping in between pings. Also, espeak needs to be installed.
This command line detect ldap hosts, by mandatory dns entry, then ping them to detect response average. based on ping response average it sorts and print the faster server in first output line Show Sample Output
Tested in Debian, ymmv. - c 1 : send only one ping;; -W 1: wait for one second and then exit ping, assuming target IP is not available; change as needed (-W 0.5 for half a second, smaller or greater value depending on network speed/latency)
Ping machine once, waiting 1 second for response until failing. Upon fail, ssh globally, otherwise ssh locally.
This command only check the network connection from given eth. This is very useful if you are using more then one interface in your server or laptop. Show Sample Output
This is like ping -a, but it does the opposite. It alerts you if the network is down, not up. Note that the beep will be from the speaker on the server, not from your terminal. Once a second, this script checks if the Internet is accessible and beeps if it is not. I define the Net as being "UP", if I can ping Google's public DNS server (8.8.8.8), but of course you could pick a different static IP address. I redirect the beep to /dev/console so that I can run this in the background from /etc/rc.local. Of course, doing that requires that the script is run by a UID or GID that has write permissions to /dev/console (usually only root). Question: I am not sure if the -W1 flag works under BSD. I have only tested this under GNU/Linux using ping from iputils. If anybody knows how portable -W is, please post a comment.
I have used single packet, and in a silent mode with no display of ping stats. This is with color and UI improvement to the http://www.commandlinefu.com/commands/view/10220/check-if-a-machine-is-online. It is as per the enhancements suggested. Show Sample Output
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list. Show Sample Output
this is very useful when there is a different network host to determine which are turned on or not Show Sample Output
8.8.8.8 and 8.8.4.4 are two Google public DNS. As their address is really simple, it's easy to use this command to test if Internet is reachable. Beware of large corporate networks however, that may use this address on router's loopbacks interfaces.
If you're very busy and don't want to wait for a ping response, use it. This command will be waiting for a successful ping response, to play a sound file to warn you that the target host is available.
pcspkr have to be enabled! modprobe pcspkr xset b on
In case sed and awk are not available you may use this to remove the last character from a string with "rev" and "cut". Show Sample Output
Linux - starting with a packetsize that must be split into two packets, count down by 8 bytes, and try to send the packet using the "Don't Fragment" option. The actual MTU (the size of the actual PING packet) is (in this example) 1460 data bytes + 20 bytes IP header + 8 bytes PING request = 1488 Show Sample Output
For less time Show Sample Output
%t are tens. %d are digits. One may have further outer loops to provide hundreds, thousands, etc. This example applies ping to the numbered machines. The pattern can be used in other ways to apply all combinations of components to a task. Show Sample Output
Execute commands serially on a list of hosts. Each ssh connection is made in the background so that if, after five seconds, it hasn't closed, it will be killed and the script will go on to the next system. Maybe there's an easier way to set a timeout in the ssh options...
Cleaned up and silent with &>/dev/null at the end. Show Sample Output
Used in OS X. tr "\n" ";" may be replaced by echo ";" with linux versions of date. I reused ping -q -c 1 www.google.com|tail -1|cut -d/ -f5 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: