My Computer Tips

My Computer tips has over 290 tutorials and tips.

Valid CSS!

Categories

How do I securely delete a file using the shred command in Linux

ID: 414

Category: Linux Terminal

Added: 11th of November 2025

Views: 56

shred command

If you have files on your Linux system that need securely deleting you can use the shred command. The standard shred command without specifying any other options, overwrites a file three times with random data, making it extremely difficult to recover any data.

To delete a file using the shred command enter the following in the terminal

shred {filename}

To delete a file and overwrite it 5 times use the -n switch
shred -n 5 {filename}

When you shred a file, it will be overwritten but not deleted. To delete the file use the -u switch
shred -u -n 5 {filename}

To view the progress use the -v switch
shred -u -v -n 5 {filename}

For more information on the shred command, you can view the manual page in the terminal
man shred