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.

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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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



Commands tagged beep from sorted by
Terminal - Commands tagged beep - 13 results
xset b 50 1700 10
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.

hl() { while read -r; do printf '%s\n' "$(perl -p -e 's/('"$1"')/\a\e[7m$1\e[0m/g' <<< "$REPLY")"; done; }
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".

dd if=/dev/urandom of=/dev/dsp
2010-10-27 09:25:02
User: khashmeshab
Functions: dd

Sends random sounds to your sound card output (e.g. your speaker). Think... You can also run it remotely on another computer using SSH and scare its user!

dd if=/dev/urandom of=/dev/speaker bs=1
2010-10-27 09:22:40
User: khashmeshab
Functions: dd

Sends random beeps to your PC-speaker. Think... You can also run it remotely on another computer using SSH and scare its user! Don't forget to run it on your dedicated hosting server and watch sysadmin's action from data-center's live remote cameras!

while :; do ping -W1 -c1 -n > /dev/null || tput bel > /dev/console; sleep 1; done
2010-09-24 06:34:12
User: hackerb9
Functions: ping sleep tput

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 (, 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.

setterm -blength 0
setterm -bfreq 0
2009-11-16 17:34:39
User: mvrilo
Functions: setterm
Tags: bell speaker beep

or change the frequency of the beep

echo "blacklist pcspkr"|sudo tee -a /etc/modprobe.d/blacklist.conf
2009-09-27 11:42:47
User: sliceoflinux
Functions: echo sudo tee

This command will disable the beep sound from the PC speaker.

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
Tags: ping beep

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.

l=500; x=500; y=200; d=-15;for i in `seq $x $d $y`; do beep -l $l -f $i;done
2009-07-07 22:12:20
Tags: bash beep sound

Generates a frequency sweep from $x to $y, with $d numbers inbetween each step, and with each tone lasting $l milliseconds.

while true; do [ "$(ping -c1W1w1 server-or-ip.com | awk '/received/ {print $4}')" != 1 ] && beep; sleep 1; done
2009-03-31 20:47:56
User: sudopeople
Functions: sleep

pings a server once per second, and beeps when the server is unreachable.

Basically the opposite of:

ping -a server-or-ip.com

which would beep when a server IS reachable.

You could also substitute beep with any command, which makes this a powerful alternative to ping -a:

while true; do [ "$(ping -c1W1w1 server-or-ip.com 2>/dev/null | awk '/received/ {print $4}')" = 1 ] && date || echo 'server is down!'; sleep 1; done

which would output the date and time every sec until the ping failed, in which case it would echo.


Requires beep package.

May need to run as root (beep uses the system speaker)

Tested on Ubuntu which doesn't have beep out of the box...

sudo apt-get install beep