You likely delete files daily. Perhaps old documents, downloads you no longer require, or even sensitive work files or personal records. While most people assume a file they have deleted is gone forever, the truth is somewhat less comforting.
On Linux and macOS, a normal delete operation removes the file’s reference; the data itself often remains on disk and can be recovered with appropriate tools.
If you store financial records, client data, or passwords, that matters. Secure deletion is how you make sure files are really gone and can’t be recovered later. This guide explores how secure deletion works on Linux and macOS, what tools you can choose, and when to use them.
Why normal deletion isn’t enough
When you delete a file on Mac using the rm command or a file manager, the operating system essentially says, “OK, this space on disk is now free to use!” That’s it. Until new data overwrites it, the original content can still exist on the drive.
Secure deletion solves this by overwriting file data and then deleting it. That way, the file cannot be recovered, not even with special disk tools. The method depends on the operating system and the type of drive (HDD vs. SSD).
For personal systems, combining secure deletion with good cleanup habits, such as using a dedicated MacBook Cleaner, is often enough. It’s a method that presents no risks, especially if you regularly delete large amounts of temporary files, cache data, or leftover system files.
Secure file deletion on Linux
Linux provides several command-line utilities for secure deletion. Each has its strengths and limits, so it is good to know when to use which one.
- Using shred for overwriting files,
shred is one of the most widely used secure deletion tools on Linux. After deleting a file, it will overwrite it several times with random data.
A simple example would be this: shred -u -z -n 3 filename.txt
This overwrites the file three times, then writes zeros to it a final time before deleting it—very difficult to recover from a traditional hard drive. However, on SSDs and journaling file systems, the OS may move data behind the scenes, which limits how reliable shred overwriting can be.
- Secure deletion with wipe
Wipe is another tool that was designed for secure deletion. It supports several overwrite patterns and can operate on files and directories.
After installation, this is how you can remove a file: wipe filename.txt
It’s slower than a normal delete, but that’s the trade-off for better data removal. For folders with many small files, expect the process to take some time.
- Full-disk encryption
Modern Linux systems are considered more secure, but it’s often the case that you get better protection by doing full-disk encryption than you would by a file-by-file wipe. If your drive is encrypted, then simply deleting the encryption key will render the data unreadable.
Secure deletion tools still help, but encryption reduces your risk even if you should leave some data blocks behind.
Secure file deletion on macOS
macOS manages storage in ways that differ from older systems and even from some newer Apple hardware. That’s why the steps taken for secure deletion are also a bit different.
Older versions of macOS included a “Secure Empty Trash” option. Apple removed it because modern file systems and SSDs make secure overwriting unreliable at the file level. Data may be copied or moved automatically, even during deletion.
- Deleting files using the rm command
The standard rm command deletes files, but it does not securely delete them. There is no built-in macOS equivalent to Linux’s shred that works reliably across all modern systems.
You may still see references to rm -P, which tries to overwrite files. This option is deprecated on current versions of macOS, so you should not rely on it if you’re dealing with sensitive data.
- FileVault and encrypted storage
On macOS, FileVault is your strongest defense. When enabled, your entire drive is encrypted. After a file is deleted, the remaining data blocks are encrypted, making them much harder to recover without account access. It’s a good security habit to get into and goes well with system-hardening tasks such as restricting access and protecting sensitive data.
Securely deleting external drives and disks
Sometimes you may need to delete more than just individual files, particularly if you’re selling or donating a drive.
- Linux disk wiping basics
On Linux, dd can overwrite an entire disk: dd if=/dev/zero of=/dev/sdX bs=1M
This will replace all the data with zeros. Be careful, as the method erases everything on the selected drive.
- macOS Disk Utility
If you use external drives on macOS, Disk Utility includes built-in secure delete options. You can choose how many overwrite passes to use when erasing non-SSD drives. For SSDs, a standard erase combined with encryption is the safest option.
Conclusion
If you care about your privacy, deleting files the right way really does matter. On Linux, for example, you have complete control over how data is removed with tools like shred or wipe. On macOS, most of the legwork is done for you through encryption and careful system cleanup.
The trick is understanding what your operating system does behind the scenes and why. That helps you choose the right method so you don’t fret about old files coming back to haunt you.