Securely Delete Files with shred
shred overwrites a file with random data multiple times before unlinking it, defeating simple file-recovery tools.
01Command
$ shred -u -v -n 3 secret.txt02What it does
Plain rm only unlinks the filename — the data blocks stay on disk until overwritten, which is what recovery tools read back. Options: `-n` passes (3 is the common choice), `-z` writes a final pass of zeros so the file doesn't look shredded, `-u` unlinks after. shred works file-by-file and cannot handle copies that exist elsewhere: snapshots, editor backups, or journaling filesystem copies survive it.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- shred(1) - Linux manual pageEvidence: shred repeatedly overwrites a file with random data; -n sets the number of passes, -z adds a final zero pass to hide shredding, and -u removes the file afterwards.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Generate a modern Ed25519 public/private key pair in ~/.ssh for authenticating to servers and Git platforms without passwords.
Add or remove read, write, and execute permission for the owner, group, or others using symbolic or octal modes.
Add a UFW rule to permit inbound traffic on a TCP or UDP port, such as SSH on port 22.