• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

shred Command Examples in Linux

by admin

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.

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. UNIX / Linux : What is the correct permission of /tmp and /var/tmp directories
  2. kpartx: command not found
  3. btrfs property Command Examples in Linux
  4. pdftoppm Command Examples in Linux
  5. eva: Simple calculator REPL, similar to bc, with syntax highlighting and persistent history
  6. Difference between the Java heap and native C heap
  7. jpegtran: command not found
  8. “az sshkey” Command Examples (Manage ssh public keys with virtual machines)
  9. What is umask in UNIX/Linux
  10. UNIX / Linux : How to lock or disable an user account

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright