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:



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.




Google text-to-speech in mp3 format

Terminal - Google text-to-speech in mp3 format
wget -q -U Mozilla -O output.mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world
2011-03-08 14:05:36
User: sairon
Functions: wget
Google text-to-speech in mp3 format

EDIT: command updated to support accented characters!

Works in any of 58 google supported languages (some sound like crap, english is the best IMO).

You get a mp3 file containing your query in spoken language. There is a limit of 100 characters for the "q" parameter, so be careful. The "tl" parameter contains target language.


There is 1 alternative - vote for the best!

Terminal - Alternatives
say() { mplayer "http://translate.google.com/translate_tts?q=$1"; }
2011-09-08 03:34:24
User: daa

Usage examples:

say hello

say "hello world"

say hello+world

say(){ mplayer -user-agent Mozilla "http://translate.google.com/translate_tts?tl=en&q=$(echo $* | sed 's#\ #\+#g')" > /dev/null 2>&1 ; }
t2s() { wget -q -U Mozilla -O $(tr ' ' _ <<< "$1"| cut -b 1-15).mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=$(tr ' ' + <<< "$1")"; }
2013-10-16 23:29:59
User: snipertyler
Functions: cut tr wget

Usage: t2s 'How are you?'

Nice because it automatically names the mp3 file up to 15 characters

Modified (uses bash manip instead of tr)

t2s() { wget -q -U Mozilla -O $(cut -b 1-15

p=$(echo "hello world, how r u?"|sed 's/ /+/g');wget -U Mozilla -q -O - "$@" translate.google.com/translate_tts?tl=en\&q=$p|mpg123 -
2011-09-19 23:06:15
User: jhansen
Functions: echo mpg123 sed wget

same but redirecting to player and putting whaever text line.. works on my ubuntu machine ...

curl -A "Mozilla" "http://translate.google.com/translate_tts?tl=en&q=$(echo "$@" | sed 's/ /+/g')" | play -t mp3 -
2012-03-04 00:40:50
User: alphapapa

Whatever arguments you pass will be spoken out loud. (Put it in a script or shell function.)

Know a better way?

If you can do better, submit your command here.

What others think

Wow, I could spend all afternoon listening to my name in different European accents :-)

Comment by flatcap 211 weeks and 2 days ago

I tried this with Vietnamese, which I enter using unicode on a text editor and paste into the command line. However, I get nonsense back in the mp3 file. My command:

wget -q -U Mozilla -O output.mp3 "

It plays fine in the browser, which converts the URL:


However, when I paste this url in the command line, I still get giberish:

wget -q -U Mozilla -O output.mp3 "

Any suggestions?

Comment by vinhdizzo 211 weeks and 2 days ago

I can't seem to get it to work, too. I guess it is an issue with wget? http://savannah.gnu.org/bugs/index.php?20863

Maybe curl will work?

Comment by sairon 211 weeks and 2 days ago

You could try piping the desired text into iconv to convert it to UTF-8 and only after that pipi the text into wget.

Comment by sairon 211 weeks and 2 days ago

I tried piping to iconv: no go.

curl also doesn't work.

Comment by vinhdizzo 211 weeks and 2 days ago

it works great, i change it to function

### usage: texttospeach en hello+world

texttospeach() {

wget -q -U Mozilla -O output.mp3 "


Comment by chmurli 211 weeks and 2 days ago

We now can play the sound live without the need to save the mp3 file before with a bash function ( a bash builtin replace all spaces by the + caracter ) :

say() { curl -s -A "Mozilla/5.0" "http://translate.google.com/translate_tts?tl=en&q=${@// /+}" | play -t mp3 -; } say "hello world"
Comment by sputnick 209 weeks and 3 days ago

Note on the previous command : requires sox

Comment by sputnick 209 weeks and 3 days ago

I've written a small ash shell script which can handle text flowing from a pipe and also gives you a warning when you exceed the 100-character limit. http://saironiq.blogspot.com/2011/03/google-text-to-speech-api.html

Comment by sairon 209 weeks and 2 days ago

I use wget with Google Translate to send sound to my Airport Express device: http://www.geekytidbits.com/2011/05/text-to-speech-through-airtunes/

Comment by bradyholt 197 weeks and 5 days ago

Are there alternative voices? Like male / female?

Comment by jesuisbenjamin 130 weeks and 4 days ago

AFAIK there are no alternative voices

Comment by sairon 130 weeks and 4 days ago

Your point of view

You must be signed in to comment.