Pin Me

Ripping Audio CDs at the Command Line

written by: Michael Dougherty•edited by: J. F. Amprimoz•updated: 1/30/2012

There are a number of excellent GUI tools in Linux for converting the contents of an audio CD to a digital format like MP3. While these tools are good, sometimes nothing beats the command line for getting the job done quickly and efficiently. And that sums up ripit.

  • slide 1 of 8

    A Little Background

    ripit is a Perl script that acts as a front-end to any one of several audio encoders and CD software. Using a set of options that you specify, ripit does the following:

    • Gets information about the CD and its tracks from Gracenote (formerly CDDB), an online repository of CD information.
    • Converts the tracks on the CD to digital format.
    • Encodes the digital files to MP3, Ogg Vorbis, FLAC, or FACC formats.

    Throughout the ripping process, ripit will ask you for input. You can either accept the script's defaults or enter the information that you want.

  • slide 2 of 8


    First, you'll need to download the archive that contains the script. Then, extract the file from the archive and copy it to a directory in your path. I put it in the directory /usr/local/bin.

    To use ripit, you need Perl (which is usually installed with Linux), an encoder like LAME, a piece of free software for creating MP3 files, and a utility called cdparanoia. You'll also need a Perl module called CDDB_get which is used for getting information from, and posting to, Gracenote.

  • slide 3 of 8

    Using the Script

    Put a CD in your CD-ROM drive, open a terminal window, and type at the command line. The script will walk you through the CD ripping process and then rip all of the tracks on the CD.

    Of course, you might want to exercise a little more control over the way in which ripit does its job. That's where the script's options come in.

  • slide 4 of 8

    Taking Advantage of the Options

    ripit has a large number of options. You can get a full listing of the script's options by typing ripit -h at the command line. You'll find though, that you'll use fewer than 10 of them. Here is one of the more useful ones:

    The --outputdir <directory> option specifies the folder into which your MP3 files will be written.

  • slide 5 of 8

    Taking Advantage of the Options, Continued

    Rip Audio CD from Command Line in Linux By default, ripit generates a playlist file (with the extension .m3u) in the folder along with your MP3 files. I've never found that file to be very much use; your mileage may vary. If you don't want the file, specify --noplaylist to make sure that it's not created.

    If you're working on a computer without Internet access, or want to enter the tag information yourself, then you can use the --nosubmission option. The information about the CD is written to a file called cddb.toc on your hard drive.

    Each format that ripit supports requires a separate piece of software (called an encoder) to create files. If you only have one encoder installed on your system, then ripit will use it. If you have encoders for all of the supported formats, then ripit will default to using LAME (for creating MP3 files). However, you can use the -c option to specify the encoder that you want to use. You include one of the following numbers with the -c option: 0 (LAME), 1 (Ogg Vorbis), 2 (FLAC), 3 (FAAC).

    To rip particular tracks on a CD, type a comma-separated list of the track numbers. So, if you only want tracks 2, 4, and 7 type ripit 2,4,7.

  • slide 6 of 8

    Putting It All Together

    So, how do all of these options fit together? Like this:

    ripit -c 1 --outputdir /home/username/music --nosubmission 2,3,4,6,9

    That set of options writes Ogg Vorbis files to the folder /music in your home folder. Only tracks 2, 3, 4, 6 and 9 will be ripped and I'll enter information about the tracks at the command line.

  • slide 7 of 8

    Closing thoughts

    ripit is a great alternative to the GUI CD ripping applications available for Linux. It does take some work to get the software that the script interacts with set up. But once that's out of the way, you'll find that using ripit to rip your CDs is quick and painless.

  • slide 8 of 8

    Images and References

Essential Linux Utilities

Looking at the best Linux Utilities for the command prompt and GUI.
  1. Essential Linux Utilities: At the Command Line
  2. Ripping Audio CDs at the Command Line