I wish to run K3b from the command line. I do not mind if it opens windows, as long as I do not have to click in them and they ultimately close. Specifically, I wish to run k3b --copy /dev/cdrom. This works, of course, but I have to click a window to actually start the processing, which is annoying in my context.

The reason I want to do everything from the command line is to embed it all in a simple script, and forget it as soon as it is started (Yes, I know I cannot fill the drive from the command line ... not yet :-) )

I know that many of the K3b processing features are just MMI embedding of independent applications, which could be called independently of K3b (K3b explicitely lists them). But this apparently not the case for k3b --copy.

I am running Mageia Linux with Kde.

Added after first answers

I do not want to burn new copies. This is exclusively to have ISO images of the CDs/DVDs, for processing on hard disk. My archive is fairly large and unwieldy on optical media.

I realize K3b is bloated. But it has been doing a good job for me so far, and I tend to trust it. Suggestions of other applications are certainly useful, still.

This said, I like command line, and I am interested in an answer to my original question if there is one.

  • What does the --copy option? – Spack May 25 '13 at 13:20
  • 1
    Is there a specific reason you want to use k3b (a GUI app) and not a command line tool? You can rip/burn/copy CDs directly from the command line with no need for k3b or similar. – terdon May 25 '13 at 13:30
  • The --copy option is to make a copy of the CD/DVD. It can actually be used to burn a new copy on optical media, but I never tried it. I only use it to copy images on hard disk. Once the window opens, you can choose to make an image or a new disk by clicking in the window. However, the choice can also be made from the command line with a little bit of programming. – babou May 25 '13 at 19:40
  • It just doesn't make much sense to run k3b from the command line, it is just a graphical front end that calls the same programs I mention in my answer (or perhaps mkisofs depending on your setup). In any case, if you just want to make an image, step 2 of my answer below is exactly what you need. – terdon May 25 '13 at 20:16
  • "it is just a graphical front end" ... You are correct for most applications. I have been exploring a bit the structure and the code, done some testing, and asked questions on another forum. Apparently, this part of K3b is hardcoded, and not a front-end for an external application. I may have erred, but I do not think so. I find it surprising that they would no follow their usual architecture by organizing it as an independent application that can be used from the command line. I even consider it poor programming practice ... but I do not know enough about it to be a good judge. – babou May 26 '13 at 0:03

Assuming you just want to be able to read/write CDs from the command line and don't have any specific reason to use k3b (which is a fairly bloated app and really not a good choice to use for scripting), you should install CLI tools for CD manipulation. You don't say what you are actually trying to do but I imagine you are attempting to make a copy of a CD.

  1. Install wodim (as root)

    urpmi cdrkit
  2. Make an ISO image of the CD (change /dev/cdrom to point to your actual CDROM drive)

    readom -v dev=/dev/cdrom f=/path/to/isoimage.iso
  3. Burn the image to a blank CD

    cdrecord -v dev=/dev/cdrom /path/to/isoimage.iso

For more information see here and here.


I've written about this topic extensively on my blog here in these articles titled:

In general there are different methods for ripping a CD to an ISO vs. backing up a DVD.


To backup DVDs you'll often times see the method of using dd to dump the contents to an ISO file. This will work most of the time but doesn't actually check that the data is being read correctly, so it's often times better to use a tool with error correction built in like dvdbackup. The main page for dvdbackup is here as well.

$ cd /dir/where/you/save/the/dvd

# insert DVD to be copied
$ dvdbackup -M
$ genisoimage -dvd-video -udf -o movie.iso /dir/where/you/save/the/dvd
$ eject /dev/dvd

to burn

# now insert a blank DVD
$ growisofs -Z /dev/dvd=movie.iso


Again with CDs you could use dd but this isn't the appropriate tool for correctly copying the contents of a CD to an ISO. Better to use a tool such as readom.

$ readom dev=/dev/scd0 f=/home/saml/test.iso
$ readom dev=/dev/cdrom f=/home/saml/test.iso

to burn

# CD - pseudo SCSI syntax
$ cdrecord -v -pad speed=1 dev=0,0,0 test.iso

# CD - 
$ cdrecord -v -pad speed=1 dev=/dev/scd0 test.iso

Checking out an ISO

You can mount the ISO files as follows:

# mount ISO file
$ mount -o loop ~/backup.iso /mnt

# display contents of backup.iso file
$ tree -L 1 -CpD /mnt/CC_v1.0
|-- [dr-xr-xr-x Nov 29  0:02]  apps
|-- [-r-xr-xr-x Nov 29  0:01]  backup.sh
|-- [dr-xr-xr-x Nov 28 23:39]  bin
|-- [dr-xr-xr-x Nov 28 23:43]  code
|-- [dr-xr-xr-x Nov 28 23:39]  docs
|-- [-r-xr-xr-x Nov 29  0:01]  make_cd.sh
`-- [-r--r--r-- Nov 28 23:43]  md5sum.txt

4 directories, 3 files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.