June 16, 2011
Well, not *that* interactive

I always alias rm to rm -i to prevent fat-fingered mishaps. This is usually too chatty if you try to recursively delete even a moderately big directory, so you have to go all out with rm -rf.

I get chills every time I type that little f in there and it turns out the new version of rm from GNU coreutils allows an alternate interactive mode -I that will prompt you once for all arguments. It also skips prompting altogether if you specify less than 4 files for deletion.

From the man page for rm:

If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --recursive are given, then rm prompts the user for whether to proceed with the entire operation. If the response is not affirmative, the entire command is aborted.

11:23am  |   URL: http://tmblr.co/Zn_4by68jQ-r
  
Filed under: rm shell linux 
October 23, 2010
Secure delete with rm on OS X

I discovered this gem in the rm man page on OS X the other day:

-P  Overwrite regular files before deleting them.  Files are
    overwritten three times, first with the byte pattern 0xff,
    then 0x00, and then 0xff again, before they are deleted.

So there you go rm -P will securely delete a file from your disk with minimum hassle (i.e. without having to through the Thrash folder). This might be one of those goodies OS X inherited from BSD. On Linux you have to use something like shred to achieve the same thing.

Addendum: santry on the HN Thread points out the same thing can done via the srm command. Several people also noted that secure delete interacts unpredictably with modern file systems. jrockway points out that full disk encryption should be used in place of secure delete for this reason.

9:02pm  |   URL: http://tmblr.co/Zn_4by1Ia1s9
  
Filed under: cli rm os x security 
Liked posts on Tumblr: More liked posts »