Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Today, jc at trillian.mit.edu gleaned this insight: > christoph wrote: > | Derek Martin wrote: > | > $ ls -i |grep f2 > | > 33845 -f2 > | > $ find . -inum 33845 -exec rm {} \; > |> | this is equal to 'rm ./-f2' > I wonder what the most abstruse way to remove a file might be? > The above use of find to locate a (known) file by inum and remove it > is certainly a contender, and all the steps are actually required by > the algorithm. It's even more wasteful than loading the entire > directory into an editor and telling the editor to delete the file. ...assuming that editor is already running or in buffer cache. If it isn't, it will most likely still be loading long after the find command completes. Most editors that can do this are BIG, and take a long time to load and initialize (and c'mon, we're talking about emacs here, aren't we?) [snip] > I wonder if we can discover a worse scheme? It's quite a matter of perspective. The method I suggest works for all known variants of Unix on all files, including those whose filenames contain unprintable characters (unless of course the FS is completely munged, in which case you're fscked anyway). On some (mostly old) Unix variants, it's the ONLY way to remove such a file from the command line. In that regard, it could be considered the best way to remove a given file. Or perhaps at least the best method to know. The rm -- -f2 version is GNU rm specific IIRC, and the rm ./filename won't work for files with non-printable characters. [O.k. depending on your shell, you might be able to do it using octal expansions... if your ls command will show them.] Your only other alternative (that we've mentioned) is to write your own custom C program (or similar language), compile it, and run it. find is much faster. -- You know that everytime I try to go where I really want to be, It's already where I am, cuz I'm already there... --------------------------------------------------------------- Derek D. Martin | Unix/Linux Geek ddm at MissionCriticalLinux.com | derek at cerberus.ne.mediaone.net --------------------------------------------------------------- - Subcription/unsubscription/info requests: send e-mail with "subscribe", "unsubscribe", or "info" on the first line of the message body to discuss-request at blu.org (Subject line is ignored).
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |