in reply to Deleting an Odd Filename

I learned this technique from the Unix Power Tools book: use the two-step process of ls (to identify the file's i-number) and find (to remove the file). For example, if ls shows the i-number to be 6239:
$ find . -inum 6239 -exec rm {} \;

Replies are listed 'Best First'.
Re^2: Deleting an Odd Filename (inode)
by afoken (Chancellor) on Jun 02, 2009 at 22:57 UTC

    Nice, but it will delete ALL hardlinks to the file that are in or below the current directory, not just the file you want to delete. (OK, files with more than one hardlink are rare except when busybox is near.)

    # touch foo
    # ln foo bar
    # ls -li
    total 0
    54804566 -rw-r--r-- 2 alex users 0 2009-06-03 00:52 bar
    54804566 -rw-r--r-- 2 alex users 0 2009-06-03 00:52 foo
    # find . -inum 54804566 -exec rm {} \;
    # ls -l
    total 0
    #
    

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)