1. # initialize the variable ISO_DATA which points to the information you wish to write to a cd/dvd, and the variable ISOFILE which specifies name and location for the cd/dvd image:
     export ISO_DATA=/home/$USER
     export ISOFILE=/tmp/image.iso
     sudo ls -al $ISOFILE 
    
  2. # create the iso image, write it to $ISOFILE and make it contain all files found in $ISO_DATA (including all subdirectories):
     mkisofs -J -r -o $ISOFILE -R $ISO_DATA 
    
  3. # test the newly created iso image (optional step):
     sudo mount -t iso9660 -o loop,ro $ISOFILE /cdrom
     ls -alR /cdrom
     sudo umount /cdrom 
    
  4. # find out which cd/dvd writer can be used:
     export CDWRITER=`sudo cdrecord -scanbus|grep RW|head -1|cut -f2`
     if [ :$CDWRITER: == :: ];then
       export CDWRITER=`sudo cdrecord -scanbus|grep DVDRAM|head -1|cut -f2`
       fi
     if [ :$CDWRITER: == :: ];then
       export CDWRITER=`sudo cdrecord -scanbus|grep SD-R2512|head -1|cut -f2`
       fi
     if [ :$CDWRITER: == :: ];then
       export CDWRITER=0,0,0
       echo REMARK: your cd writer device could not be detected automatically...
       echo REMARK: using $CDWRITER as default device...
       echo REMARK: check whether your default device behaves properly with:
       echo sudo cdrecord -scanbus
       fi
     echo we will be using device :$CDWRITER: to write your cd/dvd to... 
    
  5. # if you wish to clean an existing cd/rw, you can burn the data with:
     time sudo cdrecord dev=$CDWRITER -blank=fast -v -eject $ISOFILE 
    
  6. # if you are using a blank cd/rw, you can burn the data with:
     time sudo cdrecord dev=$CDWRITER -v -eject $ISOFILE