shred: command not found

Before encrypting a device, it’s a good idea to overwrite its contents with random data or all zeros. This ensures that no sensitive data from past use remains on the device. The shred command can be used to securely wipe a storage device in this manner.

If you encounter the below error while running the nohup command:

shred: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
OS X brew install coreutils
Debian apt-get install coreutils
Ubuntu apt-get install coreutils
Alpine apk add coreutils
Arch Linux pacman -S coreutils
Kali Linux apt-get install coreutils
CentOS yum install coreutils
Fedora dnf install coreutils
Raspbian apt-get install coreutils

shred Command Examples

1. Overwrite a file:

# shred file

2. Overwrite a file, leaving zeroes instead of random data:

# shred --zero file

3. Overwrite a file 25 times:

# shred -n25 file

4. Overwrite a file and remove it:

# shred --remove file

Conclusion

Digital shredding in Linux is done with the shred command. Its usage is very similar to the rm command, though in terms of removal, shred is much more thorough. The shred command overwrites the file 25 times (which is adjustable by using the -n # option) so it is impossible to re-create it. Before using shred, however, read its man page, as its success rate is highly dependent on the type of filesystem you’re using.

Related Post