LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to delete unreadable file? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-delete-unreadable-file-827289/)

windstory 08-19-2010 01:57 PM

how to delete unreadable file?
 
1 Attachment(s)
how to delete unreadable file?

As you can see at attached picture, there is two unreadble files at root directory.

Code:

-rw-r--r--  1 root    root  6643  8월 30  2005 +?+?++ ?+┧++?+ +痰ㄹ?++-? ┧ +痰ㄶ? 찻+候?.txt
-rw-r--r--  1 root    root  4652  8월 30  2005 +?+?++ ?+┧++?+ +痰ㄹ?++-? ┧ +痰ㄶ? 찻+候?.txt.bak
drwxr-xr-x  10 sitetest  502  4096  8월 19 01:08 _work
drwxr-xr-x  3 root    root  4096  8월 10 15:04 backup
drwxr-xr-x  2 root    root  4096  8월 13 23:49 bin
drwxr-xr-x  5 root    root  4096  8월 13 15:46 boot
drwxr-xr-x  2 root    root  4096  8월 14 00:25 command

Please let me know how to delete this.

Thanks in advance.

smoker 08-19-2010 02:40 PM

Do you know what they are ? It would terrible to delete something you later rely on.
If there are no other .txt or .bak files in the root directory, run rm *.bak *.txt

It's odd that in the screenshot all the entries are listed as DIR, when the suspects are clearly not directories.

penguiniator 08-19-2010 02:43 PM

The output of ls shows that they are readable. They are just not writable by anyone but root. The filenames are quite strange, though. What are you doing to try to delete them? Are you trying to do so as a regular user? Are you logged in as root? Are you using sudo? Are you having problems specifying the filename to delete? Have you tried changing the file attributes to make them writable?

The first character of each filename appears to be a plus sign. Is that correct? If so, you can use bash's tab completion feature to fill in the remaining, possibly untypable, characters of the filename. Things will be easier on you if you first rename them using the mv command to something easier to type. You must be root to do any of this, though. So, either su to root or use sudo to run your commands as root.

IW2B 08-19-2010 02:45 PM

Hi,

Available options will depend on which Linux/shell you are running. You can try the following:

From a graphical file manager
command line press tab for file name completion
Remove all .txt files prompting for confirmation, only answer y for required file
Code:

rm -i *.txt
copy and paste the file name between double quotes
Code:

ls -al "+?+?++ ?+┧++?+ +痰ㄹ?++-? ┧ +痰ㄶ? 찻+候?.txt"
List its inode value then use find to remove the file.

Code:

>touch "+?+?++ ?+┧++?+ +痰ㄹ?++-? ┧ +痰ㄶ? 찻+候?.txt"
>ls -i
1704195 +?+?++ ?+???++?+ +???????++-? ??? +??????? ???+????.txt
>find . -maxdepth 1  -inum 1704195 -exec rm {} \;

Ian

windstory 08-19-2010 03:00 PM

Thanks!

"rm -i *.txt" works!


All times are GMT -5. The time now is 04:45 AM.