Here’s an easy way to erase CD-RW and DVD-RW from command-line in Ubuntu:
you only need to install ‘wodim’ package:
sudo apt-get install wodim
Then run:
wodim -scanbus
To search for the cdrw device in case if you don’t already know.
To erase the entire disk, run:
wodim dev=/dev/cdrom blank=fast
That’s all!