↑ ↓ select, Enter open, Esc close

Securely overwrite and delete a file

Adjust the values, the command updates live
user@server
shred -u -z -n 3 -- /root/old-dump.sql

Overwrites the content three times with random data (-n 3), finally with zeros (-z), and then deletes the file (-u). Intended for dumps, keys or exports containing personal data.

Note: On SSDs, in snapshots, in backups and on copy-on-write file systems this is no guarantee. The best protection is not to leave such files lying around unencrypted in the first place.

Also searched as

  • permanently delete a file
  • shred a file in linux
  • securely remove a sensitive file
  • securely delete a database dump

Related one-liners

All in Filesystem

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.