GNU’s shred utility
The command for files and folders
For a single file, the command should be simple. For a directory,
the following command can shred the files recursively.
$ find <dir> -type f -exec shred {} \;
Effectiveness of shred in Ext3 and NTFS file systems
The cited part of shred’s manpage in the second answer interested me
to read more about the utility. In Vim, I pressed K when the cursor
is on the word shred, and opened the manpage, which claims that
using it on an Ext3 partition is fine if the partition is in either
the data=ordered (default) or data=writeback mode. How about
an NTFS partition? At the bottom, it says that the info page has
more information about the utility. I found the following section in
the info page.
Please note that `shred’ relies on a very important assumption:
that the file system overwrites data in place. This is the
traditional way to do things, but many modern file system designs do
not satisfy this assumption. Exceptions include:
- Log-structured or journaled file systems, such as those supplied
with AIX and Solaris, and JFS, ReiserFS, XFS, Ext3 (in
`data=journal’ mode), BFS, NTFS, etc. when they are configured
to journal data.
However, googling “shred ntfs effective”, I saw another post about the
utility. Due to my limited IT knowledge, searching for the word
“NTFS”, all I could understand was that “using shred on NTFS is
fine”. I searched for the word “ext3”, and found Shane’s comment,
which questioned Wayne Richardson’s advice.
True solution: Encrypt the file system
I went back to the Unix Stack Exchange question and re-read the second
solution. The feasible way is in the last line. I think many new
GNU/Linux users who have read this answer won’t think of encrypting
swap.