1753501 Members
3693 Online
108794 Solutions
New Discussion юеВ

Re: Non-ascii filename

 
SOLVED
Go to solution
Luke Morgan
Frequent Advisor

Non-ascii filename

Hi,

I have a file in my / directory that has a non ascii filename.
I believe it is that, that is causing long listings of / to hang.
There was 2 files, but one had the non-ascii char followed by qd so I managed to delete that one.
ls -b shows the filename to be \177

How can I delete,move or view this file?

Thanks

Luke
5 REPLIES 5
RAC_1
Honored Contributor

Re: Non-ascii filename

ls -il.

(note down the inode no. of file)

find . -inum "inode_no_of_file" -exec rm -fr {} \;

There is no substitute to HARDWORK
Massimo Bianchi
Honored Contributor
Solution

Re: Non-ascii filename

Hi,
it's a little tricky, try with ls first

for example

ls ?

should list only those file with exaclty one char, you might use this.

Or, for rm, use

rm -i *

This will prompt you to an answer before deleting the file. You skip all of them until the one you are interested in.


or


ls -li ?

will print the inode number, then with find you can build a thing like


find / -inum #### -exec ll () \;


and after

find / -inum #### -exec rm () \;


i used () because i have not the graph :)

HTH,
Massimo



curt larson_1
Honored Contributor

Re: Non-ascii filename

you can use rm -i with wildcards, rm -i . (if the filename is really just one character) or rm -i * (which you'll have to answer no quite a few times before getting to your file).

or you can get the inode number and use find to remove the file

ls -i to get the inode number

find . -xdev -inum inodeNum -exec rm {} \;

although i'd move the file then remove it

find . -xdev -inum inodeNum -exec mv {} newFile \;
rm newFile
Luke Morgan
Frequent Advisor

Re: Non-ascii filename

I have managed to move the rogue file.

However, I thought it was that file that was causing my ls -l / to hang.
It wasn't.

I will start a new thread concerning this issue.

Thank you all for your help.

Luke
David Totsch
Valued Contributor

Re: Non-ascii filename

WARNING ** WARNINIG ** DANGER WILL ROBINSON!

find / -inum exec rm {} \; WILL REMOVE from ALL FILE SYSTEMS ON YOUR SYSTEM!

If you are lucky enough to have only one single-character file/directory in /, you can:

ls -b ?
rm ?

File name generation will match non-printing characters. If the file name has a dash in it, "./" will insulate rm from trying to use the file name as options.

-dlt-