- The 30+ best Amazon Spring Sale robot vacuum deals: Hurry, sale ends tonight
- The Segway Max G2 electric scooter is $400 off during this anti-Amazon Spring Sale deal
- 정철환 칼럼 | 코딩만 잘하면 될까? 미래의 개발자가 갖춰야 할 역량
- The 30 best Amazon Spring Sale laptop deals 2025
- Snag the HP Victus 16 laptop for just $900 at Best Buy
Shredding files on Linux with the shred command

$ file guitar* guitar.png: data guitar.png-save: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, little-endian, direntries=5, xresolution=74, yresolution=82, resolutionunit=2, software=GIMP 2.10.8, datetime=2019:02:04 18:48:41], progressive, precision 8, 512x512, components 3
The shredded file is described simply as “data” while the copy of the original file describes the file’s content with all the numerous details about its format that you would normally expect to see.
By default, the shred command will overwrite a file three times, but you can change this by using the -n option (e.g., shred -n 25 guitar.png). The process is surprisingly fast, even if you decide to shred it many times.
If you want to shred a file numerous times and get some feedback on what is happening, add the -v option as shown below.
$ shred -vn 10 guitar.png shred: guitar.png: pass 1/10 (random)... shred: guitar.png: pass 2/10 (aaaaaa)... shred: guitar.png: pass 3/10 (ffffff)... shred: guitar.png: pass 4/10 (249249)... shred: guitar.png: pass 5/10 (db6db6)... shred: guitar.png: pass 6/10 (random)... shred: guitar.png: pass 7/10 (000000)... shred: guitar.png: pass 8/10 (492492)... shred: guitar.png: pass 9/10 (555555)... shred: guitar.png: pass 10/10 (random)...
Use the -u option if you want shred to remove the file from your file system. It will deallocate and remove the file after overwriting it. Only the un-shredded copy of the file is still available.
$ shred -u smiley.jpg $ ls -l smiley* -r--r--r--. 1 shs shs 14120 Apr 15 14:05 smiley.jpg-save
If you want, you can even shred only a specified number of bytes in a file. Here’s an example, starting with a little story:
$ cat story Once upon a time, a long time ago, there was a clever witch who decided to use the Linux shred command to get rid of her competitor's spells on a shared computer.
When the story is shredded with the argument below, the requested number of bytes are affected.