Linux Rip and Encode Audio CDs Commands

How do I rip audio CD under Linux operating systems? How do I convert .wav file to .mp3 or .ogg? How do I use encoders under Linux? How do I get music from very old and roughed CD’s from my school/wedding music under Linux operating systems using GUI tools?

To rip audio CDs under Linux operating system you need to use the following command line tools:

  1. cdparanoia – an audio CD reading and extraction utility which includes extra data verification features.
  2. lame – LAME is a program which can be used to create compressed audio files (encode) i.e. create mp3 files so that audio files can be played back by popular MP3 players.
  3. oggenc – oggenc is a program which encode audio into the Ogg Vorbis format.
  4. ripperx and K3b – GUI tools for ripping and encoding audio CDs.

This page shows how to rip audio CDs on Linux operating system using both GUI and the CLI methods.

Linux Rip and Encode Audio CDs

To rip audio CDs, first rip cd (copy audio CD contents track) and store them as a file (as track01.wav,track02.wav) in a raw format. However, .wav (raw form) files are big. You need to save disk space by converting and compressing .wav to .mp3 or .ogg lossy format. It is done using lame or oggenc encoders. CD rippers designed to extract the raw digital audio from a compact disc to a file.

Get Track and CDDA Information

Type the following command to get detailed information about drive and audio CD:
$ cdparanoia -vsQ
Sample Outputs:

cdparanoia III release 10.2 (September 11, 2008)
Using cdda library version: 10.2
Using paranoia library version: 10.2
Checking /dev/cdrom for cdrom...
	Testing /dev/cdrom for SCSI/MMC interface
		SG_IO device: /dev/sr0
CDROM model sensed sensed: TSSTcorp CD/DVDW SH-S182D SB04 
Checking for SCSI emulation...
	Drive is ATAPI (using SG_IO host adaptor emulation)
Checking for MMC style command set...
	Drive is MMC style
	DMA scatter/gather table entries: 1
	table entry size: 131072 bytes
	maximum theoretical transfer: 55 sectors
	Setting default read size to 27 sectors (63504 bytes).
Verifying CDDA command set...
	Expected command set reads OK.
Attempting to set cdrom to full speed... 
	drive returned OK.
Table of contents (audio tracks only):
track        length               begin        copy pre ch
  1.    15485 [03:26.35]        0 [00:00.00]    no   no  2
  2.    20316 [04:30.66]    15485 [03:26.35]    no   no  2
  3.    23579 [05:14.29]    35801 [07:57.26]    no   no  2
  4.    17344 [03:51.19]    59380 [13:11.55]    no   no  2
  5.    13928 [03:05.53]    76724 [17:02.74]    no   no  2
  6.    14954 [03:19.29]    90652 [20:08.52]    no   no  2
  7.    18415 [04:05.40]   105606 [23:28.06]    no   no  2
  8.    13386 [02:58.36]   124021 [27:33.46]    no   no  2
  9.    17697 [03:55.72]   137407 [30:32.07]    no   no  2
 10.    22469 [04:59.44]   155104 [34:28.04]    no   no  2
 11.    16163 [03:35.38]   177573 [39:27.48]    no   no  2
 12.    15423 [03:25.48]   193736 [43:03.11]    no   no  2
 13.    18116 [04:01.41]   209159 [46:28.59]    no   no  2
 14.    20106 [04:28.06]   227275 [50:30.25]    no   no  2
 15.    18373 [04:04.73]   247381 [54:58.31]    no   no  2
 16.    26250 [05:50.00]   265754 [59:03.29]    no   no  2
 17.    15166 [03:22.16]   292004 [64:53.29]    no   no  2
 18.    18664 [04:08.64]   307170 [68:15.45]    no   no  2
TOTAL  325834 [72:24.34]    (audio only)

Step 1 – Rip Audio CD and Create .WAV Track Files

Open a shell prompt and type the following command to rip all tracks i.e. extract an entire disc, putting each track in a separate file, enter:
$ cdparanoia -B
Sample outputs:

cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector       0 (track  1 [0:00.00])
	  to sector  325833 (track 18 [4:08.63])
outputting to track01.cdda.wav
 (== PROGRESS == [                              | 015484 00 ] == :^D * ==)   
outputting to track02.cdda.wav
 (== PROGRESS == [                              | 035800 00 ] == :^D * ==)
outputting to track18.cdda.wav
 (== PROGRESS == [                              | 325833 00 ] == :^D * ==)   

You can see all your .wav files with the help of ls command:
$ ls
Sample outputs:

track01.cdda.wav  track04.cdda.wav  track07.cdda.wav  track10.cdda.wav  track13.cdda.wav  track16.cdda.wav
track02.cdda.wav  track05.cdda.wav  track08.cdda.wav  track11.cdda.wav  track14.cdda.wav  track17.cdda.wav
track03.cdda.wav  track06.cdda.wav  track09.cdda.wav  track12.cdda.wav  track15.cdda.wav  track18.cdda.wav

The default output format is .wav. You can set to .aift or .raw depending on whether the option -a, -r or, -R is used:
$ cdparanoia -aB # use .aift format
$ cdparanoia -rB # use .raw format

To extract up to and including track 5, putting each track in a separate file, enter:
$ cdparanoia -B -- -5
To extract only first two tracks type the following command, enter:
$ cdparanoia -B -- 1-2
Sample outputs:

cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector       0 (track  1 [0:00.00])
	  to sector   35800 (track  2 [4:30.65])
outputting to track01.cdda.wav
 (== PROGRESS == [                              | 015484 00 ] == :^D * ==)   
outputting to track02.cdda.wav
 (== PROGRESS == [                              | 035800 00 ] == :^D * ==)   

Finally, you can extract from track 1, time 0:13.13 to 1:13.00, enter:
$ cdparanoia "1[:13.13]-1[1:13]"

Step 2 – Encode To .MP3 Format

To create mp3 audio file, enter:
$ lame track01.cdda.wav
Sample outputs:

Fig.01: Linux create mp3 audio files

Fig.01: Linux create mp3 audio files

You can set mode using the -m option:
lame -m Mode -b rate input.wav
Where Mode can be any one of the following:

  1. s : simple stereo
  2. j : joint stereo
  3. f : forced MS stereo
  4. d : dual mono
  5. m : mono

Setting Up Bit Rates

Several bit rates are specified in the MPEG-1 Audio Layer III standard: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 kbit/s, and the available sampling frequencies are 32, 44.1 and 48 kHz. Additional extensions were defined in MPEG-2 Audio Layer III: bit rates 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 kbit/s and sampling frequencies 16, 22.05 and 24 kHz. The -b option can be used as follows to set 160 bit rate:
$ lame -b 160 track01.cdda.wav
You can use the following bash for loop command to encode all tracks:
$ for t in track{01..18}*.wav; do lame $t; done

Step 3 – Encode To .OGG Format

Vorbis is a free software / open source project headed by the Xiph.Org Foundation. The project produces an audio format specification and software implementation (codec) for lossy audio compression:
$ oggenc track01.cdda.wav
Sample outputs:

Fig.02: Linux create .ogg audio files

Fig.02: Linux create .ogg audio files

You can set the Ogg Vorbis stream to output file name with the -o option (only valid if a single input file is specified):
$ oggenc track01.cdda.wav -o output01.ogg
Set and encode bitrate at 500 kbit/s, enter:
$ oggenc -b 500 track01.cdda.wav -o output01.ogg
Sample outputs:

Encoding "track01.cdda.wav" to 
at approximate bitrate 500 kbps (VBR encoding enabled)
	[100.0%] [ 0m00s remaining] | 
Done encoding file "output.ogg"
	File length:  3m 26.0s
	Elapsed time: 0m 08.1s
	Rate:         25.6000
	Average bitrate: 396.2 kb/s

You can specifying a maximum and average bitrate, and enforcing these:
$ oggenc input.wav --managed -b 128 -M 160 -o output.ogg
Set quality rather than bitrate (to a very high quality mode):
$ oggenc input.wav -q 6 -o output.ogg
Please note that encoding quality is set between -1 (very low) and 10 (very high). To Downsampling and downmixing to 11 kHz mono before encoding:
$ oggenc --resample 11025 --downmix input.wav -q 1 -o output.ogg
You can add some info about the track:
$ oggenc input.wav -t "Can I Trouch You...There?" -a "M.Bolton" -l "Instrumental Love Songs" -c "Other Info Here"

Say Hello To GUI Tools

You can use various GUI tools for ripping and encoding audio CD tracks under Linux operating systems.


ripperX is graphical (GTK i.e. Gnome) frontend for ripping and OGG/FLAC/MP3 encoding CD tracks. To install it type the following command:
$ sudo apt-get install ripperx
$ ripperx

Sample outputs:

Fig.03: ripperX - Ripping and OGG/FLAC/MP3 Encoding CD Tracks

Fig.03: ripperX - Ripping and OGG/FLAC/MP3 Encoding CD Tracks

Setup required fields and hit Go! button to start ripping and encoding:
Fig.04: RipperX in Action

Fig.04: RipperX in Action


K3b lets you burn CDs and DVDs. It also allows you to rip audio cds. To install k3b, enter:
$ sudo yum install k3b # redhat and friends via RPMForge k3b-extra repo
$ sudo apt-get install k3b
Next, start K3b, and click on Tools > Rip Audio Cd… (Or click on Start Ripping button)

Fig.05: Rip audio CDs using K3B Application

Fig.05: Rip audio CDs using K3B Application

You can set output format and other settings before ripping audio CDs:
Fig.06: K3b Set Audio CD Ripping Options

Fig.06: K3b Set Audio CD Ripping Options

Fig.07: K3b in Action

Linux Ripping Audio Tracks - K3b - MP3 - OGG Encoding

Further readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 13 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
13 comments… add one
  • Josh Lawrence Apr 8, 2010 @ 14:22

    Great post! I was actually looking at this yesterday and wondering how to do it, so this is great.

    Question: How would you encode all of the .wav files in a given directory? Let’s say I’m going to encode to ogg, is there some kind of nice “for i in” bash one-liner I can do to get them all?

  • ovejo Apr 8, 2010 @ 14:38

    Excellent :D

  • 🐧 nixCraft Apr 8, 2010 @ 14:41

    @ Josh

    for t in /path/to/mp3/dir/album-1/track{01..18}*.wav
      oggenc "${t}" -q 6 -o "${t}.ogg"

    Set this path and pattern as per your setup /path/to/mp3/dir/album-1/track{01..18}*.wav (e.g., /path/to/*.wav), see our for bash loop example page.


  • Josh Lawrence Apr 8, 2010 @ 14:48


    Thank you!

  • SC Apr 8, 2010 @ 19:26

    My preferred tool is “abcde” , and I rip to single file flac, where the entire CD is in one file with an embedded cuesheet so it can be easily burned to a backup CD, or reripped. So if I want MP3s, I can point abcde at the flac and rips oggs easily.

    “abcde -L -1 -M -o flac” to rip the flac
    “abcde -o ogg -L -d disc.flac” to rip ogg files from the flac.

    Now, I can safely pack away my CDs once ripped.

    • ML Sep 18, 2015 @ 20:16

      Thank You


      This great, much better than having to re-rip a CD in the future :)
      Thank You

  • maverick Apr 9, 2010 @ 10:29

    Tools are great!
    I used also works good!

  • Steven Apr 9, 2010 @ 11:43

    KDE4.3.1 (and later through updates) in openSUSE 11.2 presents the CD in various formats through Dolphin (KDE4’s file manager).
    You simply insert the CD, open it in Dolphin, and copy the contents in the format you like.
    This wil probably be like this in every Distro that has this KDE version, but I only use openSUSE, so….

  • 🐧 nixCraft Apr 10, 2010 @ 16:43

    @SC, I will try abcde and may be update faq later on.

    @ Steven, I wasn’t aware of such features under KDE4. However you get files under “~/.gvfs/cdda mount on sr0/”. But never tried to copy and convert them using .gvfs dir.

  • Mike May 10, 2010 @ 21:13

    You might also take a look at jack.

  • durkie Dec 14, 2010 @ 5:20

    Just… yum install grip -y

  • Sean Jul 8, 2014 @ 7:22

    No mention of FLAC. Fail.

  • Jasper Apr 16, 2015 @ 11:13

    Thanks, works nicely on a Mac with MacPorts as well (Except for the GUI tools). . I’d forgotten how to extract data from an audio CD.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum