commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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:
Waiting for your server to finish rebooting? Issue the command above and you will hear a beep when it comes online. The -i 60 flag tells ping to wait for 60 seconds between ping, putting less strain on your system. Vary it to your need. The -a flag tells ping to include an audible bell in the output when a package is received (that is, when your server comes online).
There are 7 alternatives - vote for the best!
I'd rather this one on Gnome, as I'm used to be listening some music while working. I've even created a bash function which receives ADDRESS as parameter.
If you can do better, submit your command here.
You must be signed in to comment.
OSX:
ping -i 60 -A IPInstead of a bell you can have OSX tell you (this one will check every 30 seconds for 5 minutes)
ping -i 30 -c 10 IP && say -v vicki 'Server is back online'Pinging your system isn't putting any "strain" on it at all. 'ping -f' that sucker, and the only "strain" you're putting anywhere is your network.
@vaporub
that will say 'Server is back online' no matter what, regardless of whether or not the ping actually works, and after all pings are done. You are essentially doing:
sleep 300; say -v vicki 'Server is back online'albeit with ping working in the mean time.
I think you may have missed the concept.
@sudopeople
No, from the man page:
> If ping does not receive any reply packets at all it will exit with
> code 1. If a packet count and deadline are both specified, and fewer
> than count packets are received by the time the deadline has arrived,
> it will also exit with code 1. On other error it exits with code 2.
> Otherwise it exits with code 0. This makes it possible to use the exit
> code to see if a host is alive or not.
Only problem is it will always wait the whole 5 minutes before telling you.
Remember about "visual bell" (http://www.faqs.org/docs/Linux-mini/Visual-Bell.html). If you use "visual bell" in your xterm, try:
xset b; ping -a IP; xset -bturn off "visual bell" before ping, and turn it on after ping.
@vaporub: good point, it still misses the mark though. Like you said, it will wait 5 min before telling you if it is up. It would work like this:
sleep 300; ping -c1 IP && say "server is up"this is a better solution:
while true; do [ "$(ping -c1W1w1 server-or-ip.com | awk '/received/ {print $4}')" = 1 ] && say -v vicky "Server is back online" || echo; sleep 1; doneIt would be annoying as hell, but you'd know it was up.
More info: http://www.commandlinefu.com/commands/view/1815/beep-when-a-server-goes-offline