Hide

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.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged sound from sorted by
Terminal - Commands tagged sound - 18 results
(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
0

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
0

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

Can use command 'amixer' to see other channels :

Simple mixer control 'Master',0

or

Simple mixer control 'Capture',0

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

-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
1

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
3

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
-5

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
2

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
4

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
7

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
5

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

amixer -c 0 set Master 1+ unmute
2009-08-15 13:00:16
User: Attentah
Functions: amixer set
0

Volume up und unmute (ignored if Master is not muted).

Replace "+" by "-" for volume down and unmute if necessary.

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
0

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
15

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.