This script securely deletes files and directories on linux and macOS by overwriting them multiple times with random data, making recovery nearly impossible.
- Securely deletes files and directories
- Allows specified number of overwrite iterations (default is 3)
- Handles both files and directories, including recursion for directories
- linux / macOS
- bash
- parallel cli command
- depending on data permissions may need to run as sudo
# Securely delete a file
./secure-delete junk_file.txt
# Securely delete a file with 5 overwrite iterations
./secure-delete junk_file.txt -n 5
# or
./secure-delete junk_file.txt --iterations 5
# Securely delete a directory
./secure-delete junk_dir
# Securely delete a directory with 5 overwrite iterations
./secure-delete junk_dir -n 5
# or
./secure-delete junk_dir --iterations 5
# Show script usage
./secure-delete --help