Various utilities are provided for writing CDs or DVDs. Perhaps the easiest method is the integrated support that various desktop file managers offer. When an empty cd or dvd is inserted, a window pops up asking you what you want to do, and one of the choices will offer a drag & drop
interface to prepare files for burning to the empty media.
Alternative tools:
Writing a DVD can be done in two different ways. One is similar to writing a CD, only using dvdrecord as the underlying utility. The script makedvd attempts to do that.
Unfortunately, the DVD-writers are not completely standardized, and the various versions of dvdrecord all have different problems. So a better way to do it is using growisofs. Short summary:
growisofs -Z /dev/dvd [options] files...
Important options: -Z to start on a new, empty disk, -M to merge new data with existing data (make sure you use the same options on each session otherwise, e.g. write all sessions with the -J option or none of them). Other options: similar to mkisofs, e.g. -J for Joliet filesystem (so windows understands long names), -r to enable RockRidge extensions (save file permissions etc), -f to follow symbolic links etc. To wite an existing ISO image to disk, use:
growisofs -Z /dev/dvd=/path/to/image.iso [options]
Note: growisofs puts the contents of the specified directories on the cd, not the directories themselves. Usually that is what you want, but if you specify multiple directories, their contents will get merged and that might i not be what you want. The workaround is to create a directory containing the subdirectories to be written, or containing links to those subdirectories. When using links, add the -f option to growisofs.