Removing files by inode
Friday, September 17th, 2010This is by no means original, nor is it mine, but I thought I would share. If you want a longer explanation go here. So basically what I did this morning is try to write a configuration file out of vim, and wasn’t paying sufficient attention and ended up writing a new file called ‘:wq. Instead of trying to figure out the quoting I just ls -i (to show inode) it returned 42076104 ‘ (as well as a bunch of others, it was the xorg.conf file if you’re really interested). So to get rid of the file just use find . -inum inode* -exec rm -f ‘{}’ \;, so for our file it would be:
find . -inum 42076104 -exec rm -f '{}' \;
Share and enjoy!
* had to update, sorry forgot angle brackets (or inequality signs) are interpolated as tags.
