What's the easiest way to write over a hard disk (such that you could give it to a friend, etc.) on elementary OS?
sudo fdisk -lto determine which
/dev/sdXdrive you will rewrite. (The drives are listed in an order:
sdafor your main drive,
sdc, etc. for your remaining drives.) Use that path in place of
sdXin the next command:
sudo dd if=/dev/zero of=/dev/sdX status=progressto write zeros to your disk. (
status=progressis a recent addition to see the process's status—it might not work on your system.)
If you'd prefer to use a GUI,
gdiskdump is relatively straightforward, but I think the above is easier than installing software for a single operation. To install, run
sudo apt install gdiskdump.