System Administration

Re: Removing special characters file

 
SOLVED
Go to solution
dictum9
Super Advisor

Removing special characters file



Any idea what this is and how to remove it?

# ls -dalb ???
-rw-r--r-- 1 root sys 0 Nov 2 10:57 \177\177\177
6 REPLIES 6
Jayakrishnan G Naik
Trusted Contributor
Solution

Re: Removing special characters file

Hi

If this is unwanted file use rm with absolute path. Have you tried using absolute path? If any error, try using double quotes for the filename.

rm /dir/\177\177\177

rm /dir/"\177\177\177"

Regards
Jayakrishnan G Naik
James R. Ferguson
Acclaimed Contributor

Re: Removing special characters file

Hi:

You can always remove a file from a filesystem by using its inode. Remember that an inode number is only unique within a filesystem.

# cd /path && ls -il

...[note the inode value]

# find . -xdev -type f -inum -exec rm -i {} +

The '-xdev' argument insures that we don't cross (out of) the mountpoint and clobber a file in another filesystem with the same inode number.

Regards!

...JRF...
Bijeesh
Respected Contributor

Re: Removing special characters file

>>Any idea what this is<<
It may be created by doing something like
#touch ????
Here the ? mark appeared while you may use the delete key or backspace key which is not properly set for the terminal.
dictum9
Super Advisor

Re: Removing special characters file

Removing by inode worked, thanks.
Dennis Handly
Acclaimed Contributor

Re: Removing special characters file

>Any idea what this is and how to remove it? \177\177\177

This is a filename with three DELs. With my stty setup, I can just type that to rm.
$ touch ^?^?^?
$ ll ^?^?^?
-rw-rw-r-- 0 Nov 4 01:39
$ ll -b ^?^?^?
-rw-rw-r-- 0 Nov 4 01:39 \177\177\177
Doug O'Leary
Honored Contributor

Re: Removing special characters file

Hey;

You should remember the inode trick... that, and how do you get rid of an empty directory named

/home/${user}/-delete-me

are good interview questions. At least they get asked on every interview I'm running.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html