Abschweifen

A wiki for things I knew and already forgotten. Written in pure HTML. Inspired by Bits from Debian.

If you have any questions or comments, you can contact me on Mastodon.


Permanently delete files with the command shred in GNU/Linux (posted on 16.02.24)

shred - Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.

To permanently delete all files within a folder (e.g. Documents) and subfolders, use the following command:

find Documents/ -type f -exec shred -uvz {} \;

After the command has been executed, all files are irretrievably deleted. Only the (sub)folders remain. To delete the empty (sub)folders, use the follwoing command:

rm -r Documents/


You can also use shred to permanently delete one file only:

shred -uvz example.txt

Default overwrites file always three times; u - deallocate and remove file after overwriting; v - show progress; z - add a final overwrite with zeros to hide shredding


Show serial number under Windows via cmd/PowerShell (posted on 06.10.25)

Use the following command to display the serial number in cmd (Windows 10 or older):

wmic bios get serialnumber


Use the following command to display the serial number in PowerShell (Windows 11 or later):

Get-WmiObject win32_bios | select Serialnumber


How to use the command hdparm to securely erase SSD/NVMe under GNU/Linux (posted on 06.10.25)

To securely erase HDDs, overwrite them completely with zeros. However, this doesn't work with an SSD/NVMe. To do that, you boot from an live-Linux-ISO/-USB-stick and execute the following command:

sudo hdparm -I /dev/sda

This command shows you specific information about the SSD/NVMe. The importend pieces are under the section Security - not enabled, not locked, not frozen.

If the SSD/NVMe is frozen you can use the command sudo systemctl suspend to suspend your PC/Notebook. Then restart your PC/Notebook and run the command sudo hdparm -I /dev/sda again to check whether the entry is set to not frozen.

To enable secure erase execute the following commmand:

sudo hdparm --user-master u --security-set-pass PASSWORD /dev/sda

PASSWORD = can be chosen freely. Please run the command sudo hdparm -I /dev/sda again to check whether the entry is set to enabled.

If everything looks fine, run the following command:

sudo time hdparm --user-master u --security-erase-enhanced PASSWORD /dev/sda

It may take a few seconds for the command to be executed. After successful deletion, the security function of the SSD/NVMe should be automatically deactivated again. Run the command sudo hdparm -I /dev/sda again to check whether the entry is set to not enabled.