How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
There are several ways to securely overwrite files using the terminal on a Mac. Here are two common methods: 1. Using `rm` with secure empty trash (older macOS versions):
1 | rm -P filename |
1 2 3 | srm -v filename # verbose mode, single overwrite srm -m filename # medium security (7 passes) srm -z filename # high security (35 passes) |
1 2 | dd if=/dev/urandom of=filename bs=1m rm filename |
Testing if the previous output contains the string shred
: False
Testing if the previous output contains the string srm
: True
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
There are several ways to securely overwrite files on a Mac using the terminal. Here are two common methods: 1. Using `rm` with secure empty trash (older macOS versions):
1 | rm -P filename |
1 2 3 | srm -v filename # verbose mode # or srm -z filename # zero-fill mode |
1 2 | dd if=/dev/urandom of=filename bs=1m rm filename |
1 2 | dd if=/dev/urandom of=filename bs=1m count=number_of_passes rm filename |
Testing if the previous output contains the string shred
: False
Testing if the previous output contains the string srm
: True
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
There are several methods to securely overwrite files using the terminal on a Mac. Here are two common approaches: 1. Using `rm` with secure empty trash (older macOS versions):
1 | rm -P filename |
1 2 3 | srm -v filename # normal secure removal srm -m filename # medium security srm -s filename # maximum security (35 passes) |
1 2 | dd if=/dev/urandom of=filename bs=1m rm filename |
1 | shred -u -z -n 7 filename |
1 2 | brew install secure-delete # for srm brew install coreutils # for shred |
Testing if the previous output contains the string shred
: True
Testing if the previous output contains the string srm
: True
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
There are several ways to securely delete files using the terminal on a Mac. Here are some methods: 1. Using `rm` with zeros (single pass):
1 2 | dd if=/dev/zero of=filename bs=1m rm filename |
1 | srm -v filename |
1 2 3 4 5 6 7 | # First pass (zeros) dd if=/dev/zero of=filename bs=1m # Second pass (random data) dd if=/dev/random of=filename bs=1m # Third pass (zeros again) dd if=/dev/zero of=filename bs=1m rm filename |
1 2 3 4 | # First fill with zeros find /path/to/directory -type f -exec dd if=/dev/zero of={} \; # Then delete rm -rf /path/to/directory |
Testing if the previous output contains the string shred
: False
Testing if the previous output contains the string srm
: True
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
How do I overwrite the data of a file on my Mac computer such that it can't be recovered from the disk using the terminal?
There are several methods to securely overwrite files using the terminal on a Mac. Here are two common approaches: 1. Using `rm` with secure empty trash (older macOS versions):
1 | rm -P filename |
1 2 3 | srm -v filename # verbose mode, standard secure deletion srm -m filename # medium security srm -s filename # simple overwrite |
1 2 | dd if=/dev/zero of=filename bs=1m rm filename |
1 2 3 | dd if=/dev/urandom of=filename bs=1m dd if=/dev/urandom of=filename bs=1m rm filename |
Testing if the previous output contains the string shred
: False
Testing if the previous output contains the string srm
: True