rm | Cleaning up recycle bin

Bob Proulx bob at proulx.com
Sun Feb 23 22:22:25 UTC 2020


Ernie Luzar wrote:
> Jos Chrispijn wrote:
> > I read somewhere that using the rm command does not phsyically remove
> > the 'deleted' files when using the command in a terminal session. Can
> > you tell me how/where I can really remove these files (as per user
> > account or in general)? Thanks!
> 
> To write zeros to existing file before removing that file
> 
> dd if=/dev/zero of=/path/filename bs=1m ; rm /path/filename

The above dd command has no count/size limitation.  It will run
copying zeros into filename until the write fails, typically at a full
disk.  It will fill the disk and then exit.  Then the rm will happen
freeing up the data.  The result is a disk usage spike up and then down.

I expect that was not what was intended.  I expect the intention was
that it would overwrite the file.  But that is not what happens with
the above and therefore I would not recommend the above.  At the least
conv=notrunc would be needed or dd truncates the file before writing.

Bob


More information about the freebsd-questions mailing list