rm -rf * / <oops>
sudo touch /%nodelete
sudo touch /.%nodelete
sudo chattr +i /%nodelete
sudo chattr +i /.%nodelete
now, if you rm -rf * / accidentally, it will fail on the /%nodelete and /.%nodelete file giving you a chance to recover from your extra space oops.
Only works on filesystems with chattr functionality, and if you are using other than LANG_C you might have to choose another symbol rather than % as a leading character, you want whatever char shows up first in the charset.
Written by Jim Richardson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#