Deleting pesky files

Here are a few examples of deleting "pesky files" in UNIX.

Example: removing "-delete_me"

1. rm ./-delete_me
2. rm -- -delete_me

Example: removing "delete me"

rm delete\ me

Example: removing files with non-printable characters.

You may have files with spaces, tabs, or other control characters in them. To display the characters not normally printed with ls, use the cat command's -vet (show-nonprinting, show-ends, show-tabs) parameters. Using ls -il to display the file's inode makes it easy to delete the files.

(user@host) /home/user> ls -il | cat -vet
total 616$
    128288 -rw-------   1 hutch    other     123551 Apr 22  2002 ^H^H^H^H^H$
    128258 -rw-------   1 hutch    other     156226 Jul 20  2001 ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H$
    128025 drwx------   4 hutch  other        512 Feb 10 10:24 hutch$

To create a Ctrl-H (^H) character, press Ctrl-V then Ctrl-H.

file ^H^H^H^H^H
:               ascii text

It is often easiest to delete these files using their inode value.

find . -inum 128288 | xargs rm
find . -inum 128258 | xargs rm

Back to

Last modified: 02/11/2003