What's this?

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/

Get involved!

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.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



ping a host until it responds, then play a sound, then exit

Terminal - ping a host until it responds, then play a sound, then exit
beepwhenup () { echo 'Enter host you want to ping:'; read PHOST; if [[ "$PHOST" == "" ]]; then exit; fi; while true; do ping -c1 -W2 $PHOST 2>&1 >/dev/null; if [[ "$?" == "0" ]]; then for j in $(seq 1 4); do beep; done; ping -c1 $PHOST; break; fi; done; }
2009-09-24 18:11:10
Functions: echo host ping read seq
ping a host until it responds, then play a sound, then exit

After this, just type:


You need to install "beep" before this would make the beep sound.

Save it in your .profile if you want to use it later

WARNING: this command won't exit until it is successful. You won't be able to CONTROL+C out of it.


There are 2 alternatives - vote for the best!

Terminal - Alternatives
Mac OSX: ping -oc 30 > /dev/null && say "Google name server is up" || say "This host is down"
2014-08-01 15:44:57
User: raulyca
Functions: ping
Tags: ping beep

Audio acknowledgement for host availability.

When running the command from a Linux systems, you can use "festival" or "espeak" instead of "say".

speakwhenup() { [ "$1" ] && PHOST="$1" || return 1; until ping -c1 -W2 $PHOST >/dev/null 2>&1; do sleep 5s; done; espeak "$PHOST is up" >/dev/null 2>&1; }
2014-11-26 10:22:18
User: aguslr
Functions: ping return sleep
Tags: ping beep espeak

This allows for sleeping in between pings. Also, espeak needs to be installed.

Know a better way?

If you can do better, submit your command here.

What others think

Rather than installing the 'beep' program, on some consoles you can run this for a beep:

echo -en "\x07"

Comment by devrick0 356 weeks and 2 days ago

You can achieve this with just ping.

ping -a -c 1

-a is emit audible bell

-c is exit after receiving count replies in this case one

Comment by haplo 356 weeks and 2 days ago

@haplo: nope. A certain number of pings may be more or less than is needful before you hear a sound. The code presented will only beep when the host finally responds-- not until an arbitrary ping count has been reached.

However you are correct about the "-a" flag to the extent that it "works". It simply does not emit any sound when I use it on my ubuntu workstation.

Comment by linuxrawkstar 356 weeks and 1 day ago

Created 2 scripts for MacOS : sayping and saytcping

The second one uses tcping, (C) 2003 [email protected]

Just want to share them but cannot attach files here ;(

Comment by theunf 9 weeks and 6 days ago

Your point of view

You must be signed in to comment.