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 sound from sorted by
Terminal - Commands tagged sound - 18 results
aplay -c 2 -f S16_LE -r 44100 /dev/urandom
(amixer get Master | grep off > /dev/null && amixer -q set Master unmute) || amixer -q set Master mute
pulseaudio -k && pulseaudio --start >/dev/null 2>&1 &
for i in *.flv *.mkv *.avi; do mplayer -ao null -vo null -ss 0 -endpos 1 >/dev/null "$i" 2> >(grep -qi error && echo >&2 "$i seems bad"); done
2013-08-20 22:23:11
User: sputnick
Functions: echo grep

If you want avoid to be annoyed when playing your favourite video files with your video player, first run this command to stash wrong files (and test tricks to play these wrong files).

amixer -c 0 set Master 1dB+
2013-07-25 15:28:45
User: chrisp6825
Functions: amixer set

adjusts the 'Master' channel's volume up by 1dB.

Can use command 'amixer' to see other channels :

Simple mixer control 'Master',0


Simple mixer control 'Capture',0

ffmpeg -i source.mpg -f s16le -acodec pcm_s16le audio.raw
2013-01-10 02:54:04
User: manuq

-i sets the source file

-f and -acodec both set the output to be raw audio, PCM signed 16-bit little endian

for x in 8svx aif aifc aiff aiffc ... wv wve xa xi ; do echo $x ; play -q -t $x soundfile trim 0 3 ; done
2011-12-09 00:23:45
Functions: echo

I wasted two hours reading the sox documentation and searching on the web for the format of some obscure fscking sound sample, and then finally came up with this. This plays only the first three seconds of your unknown formatted sound file using every one of sox's built-in filetypes. If you don't get an exact match, you may get close.


I could not fit every single type in and keep it under 127 characters, so you will have to replace "..." with the full list obtainable by `$ sox --help` (or try `Show sample output`)


note: /usr/bin/play should be linked to sox on most systems.

sox is_that_correct.wav -t raw -r 8000 -s -w -c 1 is_that_correct.sln
sudo sox <file name>.wav -r 8000 <file name>.gsm
sudo sox <file name>.wav -r 8000 <file name>.gsm
/usr/bin/play -q -n synth brown band -n 1200 200 tremolo 0.05 80
2011-04-26 19:37:08
User: Mozai
Tags: sound sox noise

Substitute 'brown' with 'pink' or 'white' according to your taste.

I put this on my headphones when I'm working in an "open concept" office, where there are always three to five conversations going in earshot, or if I'm working somewhere it is "rude" of me to tell a person to turn off their cubicle radio.

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!

lsof /dev/snd/pcm*p /dev/dsp | awk ' { print $2 }' | xargs kill
2010-07-23 20:24:16
User: alustenberg
Functions: awk xargs

for when a program is hogging the sound output. finds, and kills. add -9 to the end for wedged processes. add in 'grep ^program' after lsof to filter.

lsof | grep pcm
2010-05-16 12:12:01
User: Miles
Functions: grep

When trying to play a sound you may sometimes get an error saying that your sound card is already used, but not by what process. This will list all processes playing sound, useful to kill processes that you no longer need but that keep using your sound card.

mplayer dvd:// -softvol -softvol-max 500
2009-12-30 18:19:44
User: kanzure
Tags: mplayer sound

use '0' and '9' to increase/decrease volume. this is useful on laptops with low speaker volume.

speaker-test -D plug:surround51 -c 6 -l 1 -t wav
2009-11-05 02:57:46
User: alperyilmaz

Useful tool to test if all speaker channels are working properly. speaker-test is part of alsa-utils package

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.

sudo killall -9 pulseaudio; pulseaudio >/dev/null 2>&1 &
2009-04-11 20:18:35
User: hank
Functions: killall sudo

Ever since the switch to pulseaudio, Ubuntu users including myself have found themselves with no sound intermittently. To fix this, just use this command and restarts firefox or mplayer or whatever.