File remove command?

Albert Langer cmf851 at anu.oz.au
Tue Jun 18 04:15:58 AEST 1991


In article <922 at visenix.UUCP> beattie at visenix.UUCP (Brian Beattie) writes:

>If the real aim is to remove the data how about:
>
>cat /dev/null >offendingfile
>rm offendingfile
>
>This may leave the inode if links exist but the file will
>have been truncated to zero length i.e. no data.

Does this also get rid of the data from the original file system
blocks so they cannot be reconstructed with a file system debugger?

I imagine it doesn't. That may not be the original question but I'd
be interested in a simple shell way to do so. I assume that using cp
to write a larger file full of meaningless data over the original file
would work. Or might that result in a new file on some systems, with
the original blocks just freed?

I know it isn't as big a problem with unix, since deallocated blocks
tend to be very hard to track down and get immediately reused anyway,
but a simple equivalent to Norton's wipefile under DOS would still be 
useful and I'm sure it should be a simple shell one-liner (portable across all
reasonable unixes).

How does one fill a file with zeroes or whatever in as few keystrokes
as possible? ed?

--
Opinions disclaimed (Authoritative answer from opinion server)
Header reply address wrong. Use cmf851 at csc2.anu.edu.au



More information about the Comp.unix.shell mailing list