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

Create an audio test CD of sine waves from 1 to 99 Hz

Terminal - Create an audio test CD of sine waves from 1 to 99 Hz
(echo CD_DA; for f in {01..99}; do echo "$f Hz">&2; sox -nt cdda -r44100 -c2 $f.cdda synth 30 sine $f; echo TRACK AUDIO; echo FILE \"$f.cdda\" 0; done) > cdrdao.toc && cdrdao write cdrdao.toc && rm ??.cdda cdrdao.toc
2009-11-17 06:23:42
User: hackerb9
Functions: cdrdao echo rm write
21
Create an audio test CD of sine waves from 1 to 99 Hz

This command creates and burns a gapless audio CD with 99 tracks. Each track is a 30 second sine wave, the first is 1 Hz, the second 2 Hz, and so on, up to 99 Hz. This is useful for testing audio systems (how low can your bass go?) and for creating the constant vibrations needed to make non-Newtonian fluids (like cornstarch and water) crawl around.

Note, this temporarily creates 500MB of .cdda files in the current directory. If you don't use the "rm" at the end of the command, you can burn more disks using

cdrdao write cdrdao.toc

Prerequisites: a blank CD-R in /dev/cdrw, sox (http://sox.sourceforge.net/), and cdrdao (http://cdrdao.sourceforge.net/). I'm also assuming a recent version of bash for the brace expansion (which just looks nicer than using seq(1), but isn't necessary).

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Very nice.

Just a small note: You don't have to have bash. The very same command line works fine with zsh (even quite old versions), too, including the brace expansion.

Comment by inof 229 weeks and 6 days ago

dose not seem to work i get this error sox soxio: Failed reading `-n': unknown file type `null'

(one for each htz)

then ERROR: Cannot open audio file "1.cdda": No such file or directory

ERROR: cdrdao.toc:3: Cannot determine length of track data specification.

help?

Comment by sasnfbi1234 229 weeks and 6 days ago

Hi, Sasnfbi1234! Thanks for trying my script. I asked Google and it (he? she?) said that you don't have the proper sox libraries installed. Here's the link http://blog.px.ns1.net/2008/06/27/sox-soxio-failed-reading-unknown-file-type/

If you're using Debian (or a Debian derived distribution like Ubuntu) you can fix it like so:

apt-get install libsox-fmt-all
Comment by hackerb9 229 weeks and 6 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts