Burn CDs From Command Line

Jack Wallen
Jan 27, 2009
Updated • Nov 28, 2012

Recently I wrote a simple how-to for burning CDs in GNOME (Easy CD Burning in GNOME.) From that article a request came in to illustrate how to burn from the command line. This ability illustrates the flexibility of the Linux operating system. Not only can you burn CDs from an outstanding, and simple, GUI, you can burn them from commands.

In this article we will cover the cdrecord and dd commands where we will burn ISO images, data backups, and audio CDs.

Installing cdrecord and dd

By default, cdrecord and dd, should be installed. If not you can find it in your Add/Remove Software utility by searching for "cdrecord" and "dd". Once you have installed the applications open up a terminal window and get ready.

The first thing you need to do is to determine where your device is located. To locate your device issue the command cdrecord -scanbus. When the command runs you should see output similar to:

1000,0,0 100000) *
1000,1,0 100001) *
1000,2,0 100002) 'HL-DT-ST' 'RW/DVD GCC-T10N ' '1.00' Removable CD-ROM
1000,3,0 100003) *
1000,4,0 100004) *
1000,5,0 100005) *
1000,6,0 100006) *
1000,7,0 100007) *

As you can see above, my device is listed. The listing information I take out of this is 0,2,0. If your scanbus reports the number before the first "," as a 1000 you will only want the last digit - in my case a 0. If scanbus reports only a 0 before the first "," that will be your first number in your device location. So my device is 0,2,0.

This device address will be plugged into the command for burning in conjunction with the dev= argument.

Burning ISO image

You have data on a CD that you want turned into an ISO image. This could be a Linux distribution or anything. To do this you would issue the command:

dd if=/dev/cdrom of=ISO_file.iso

Where /dev/cdrom is the location of your CD device and ISO_file.iso name of the ISO image you want to create. NOTE: If you are wanting to put the ISO image file in a location other than where you are issuing the command, use the full path to the file name.

You can also make use of the mkisofs command to create ISO images of directories on your hard drive. The command for this would look like:

mkisofs -o Directory.iso Directory

Now let's burn that ISO image to a CD. To do this issue a command similar to:

cdrecord dev=0,0,0 -data speed=48 ISO_file.iso

The above command would put the ISO_file.iso file onto a burnable CD. If you know the actual burning speed of your device you can make adjustments to the command above.

Burn Audio CDs

What everyone has been waiting for. How to burn audio CDs. You could easily burn a directory full of .wav files with the command:

cdrecord dev=0,0,0 -eject speed=48 -pad -audio *.wav

But let's take this one step further and create a handy bash script that will do the following:

Convert spaces in file names to underscores.

Convert .mp3 files to .wav files.

Burn all .wav files to cd.

Here is the script:


# Convert spaces to underscores
for i in *.mp3; do mv "$i" `echo $i | tr ' ' '_'`; done

# Convert MP3 files to WAV files
for i in *.mp3; do mpg123 -w `basename $i .mp3`.wav $i; done

# Burn the CD
cdrecord dev=0,0,0 -eject speed=48 -pad -audio *.wav

Once you have created the script, make sure you chmod the file so it is executable like this:

chmod u+x burn_script

To run the script first move it into the directory that contains your mp3 files and issue the command ./burn_script. Or you can copy the burn_script to /usr/bin so it is a global command.

Final Thoughts

Linux is an incredibly flexible operating system. The ability to burn CDs from the command line proves just how flexible it is. Do you have other tricks you like to use along these lines? If so, share them.


Previous Post: «
Next Post: «


  1. kpb said on December 19, 2009 at 6:25 am

    Thanks for sharing this.

    How about converting man pages to pdf?

    1. syd said on January 5, 2010 at 3:30 am

      You can try this script for printing man pages to pdf:
      http://snippets.dzone.com/posts/show/4274 I just found it in a search, but it may work.

  2. gokudomatic said on January 28, 2009 at 1:12 am

    I have a server at my home that runs 24h/day at the lowest power consumption I could get. I killed X, put all tasks a daemons. But incidentally the server (a laptop) is the only computer I have that includes a burner.
    Since you’re a genius, tell me how to burn dvds with a gui on my screenless server?
    cdrecord allows me to burn a dvd only with putty/ssh and winscp. The command is usually very simple. Creating an iso is also trivial.
    And I’m still consuming 30W instead of 75W or more.

    actually I’m using wodim, but it looks like Cdrtools fork is buggy. It was still the default burner in ubuntu.

  3. jack said on January 28, 2009 at 12:07 am

    Ed: Make sure you check out the referenced article in the introductory paragraph so you can see how easy the Linux gui is to use for CD burning. The great thing about Linux is that it CAN be pretty much anything you want.

  4. Nic Moon said on January 27, 2009 at 11:50 pm

    Ed: There are GUIs, but it’s nice to know for systems that don’t have them. Also, terminal functionality in Linux is better than no functionality in Windows – they JUST added the ability to burn an ISO (sorry if you were talking about Mac).

  5. Ed said on January 27, 2009 at 10:43 pm

    Gee, and people wonder why Linux is so geeky. To each his own but there is a reason for GUIs.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.