Let's suppose we want to format (erase) a CD-RW / DVD-RW disc under Ubuntu. As a reminder, CD-RW/DVD-RW discs can be re-use it many times after recording data in them. To erase these discs from the terminal, you need to follow these simple instructions:
1. Open the terminal (Ctrl+Alt+T) under Ubuntu and unmount first the disc with this command:
Note: /dev/cdrom is the default address for CD/DVD drives on Linux. If it's different, then replace it with your own correct address.
2. To format the entire CD-RW / DVD-RW disc, run this command:
wodim dev=/dev/cdrom blank=all
3. For a quick erase, use this command:
wodim dev=/dev/cdrom blank=fast
4. To erase only the last recorded session, use this command:
wodim dev=/dev/cdrom blank=session
Your CD-RW / DVD-RW disc is now erased and ready to be used again!