Further in depth documentation on ArchWiki and man.archlinux.org.
-b
block size, 512 or 4096 unless you have a highly specialised enterprise drive (influences speed)-c
cache size (influences speed)
Safest test, no data will be written however physically damaged disks may be further damaged by continuous reads.
badblocks -vs -b 4096 -c 65536 /dev/sda
Interrupting this with a single CTRL+C
will be handled gracefully without data loss, however an ungraceful error can occur in the drive itself, IO or in OS resulting in data loss.
badblocks -nvs -b 4096 -c 65536 /dev/sda
This will overwrite all data.
badblocks -wvs -b 4096 -c 65536 /dev/sda
Note: after the drive is overwritten Windows may think drive is damaged and may prevent you from formatting it in the Disk Management GUI, ensure to format the drive with a new partition table (GPT or MBR) in Linux before use on Windows.
Note: this should not be used as a replacement for a secure erase.