LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Can't Remove A File (https://www.linuxquestions.org/questions/linux-general-1/cant-remove-a-file-622610/)

carlosinfl 02-20-2008 06:30 PM

Can't Remove A File
 
I am on a RHEL 4 server and was looking under the / directory and noticed an add entry from a few days ago:

Code:

[root@lt2fs3 /]# ls -l
total 194
drwxr-xr-x    2 root root        4096 Dec 15 04:04 bin
drwxr-xr-x    4 root root        5120 Jan 18 18:09 boot
drwxrwsr-x  13 root ctia_admin  4096 Jan  2 09:44 builds
drwxr-xr-x    8 root root        5840 Jan 19 09:51 dev
drwxr-xr-x  80 root root      12288 Feb 19 04:03 etc
drwxr-xr-x  255 root root      12288 Feb 15 09:56 home
drwxr-xr-x    2 root root        4096 Aug 12  2004 initrd
drwxr-xr-x  12 root root        4096 Feb 19 04:03 lib
drwx------    2 root root      16384 Apr  5  2007 lost+found
drwxr-xr-x    3 root root        4096 Jan 19 09:51 media
drwxr-xr-x    2 root root        4096 Sep  5 12:33 misc
drwxr-xr-x    2 root root        4096 Aug 12  2004 mnt
drwxr-xr-x    5 root root        4096 May 30  2007 opt
dr-xr-xr-x  90 root root          0 Jan 19 04:50 proc
drwxr-x---    5 root root        4096 Feb 20 19:20 root
-rw-r--r--    1 root root      19167 Feb  6 13:23 root@10.1.1.10
drwxr-xr-x    2 root root      12288 Jan 19 10:57 sbin
drwxr-xr-x    1 root root          0 Jan 19 04:50 selinux
drwxr-xr-x    2 root root        4096 Aug 12  2004 srv
drwxr-xr-x    9 root root          0 Jan 19 04:50 sys
drwxrwxrwt    5 root root        4096 Feb 20 04:02 tmp
drwxr-xr-x  15 root root        4096 Apr  5  2007 usr
drwxr-xr-x  22 root root        4096 May 30  2007 var

I am unable to cat or vim this file nor can I delete it. I does not appear to auto complete when I try and do anything to root@...

Does anyone know what my options are...?

pljvaldez 02-20-2008 06:33 PM

Try lsof root@10.1.1.10 and see if you can find out what process is using the file, then kill that process. After that, you should be able to delete it or whatever.

EDIT: You might need quotes around the filename since it has special characters.

carlosinfl 02-20-2008 06:45 PM

Quote:

Originally Posted by pljvaldez (Post 3064336)
Try lsof root@10.1.1.10 and see if you can find out what process is using the file, then kill that process. After that, you should be able to delete it or whatever.

EDIT: You might need quotes around the filename since it has special characters.

I tried the following and no results came back. I ran in under the / directory however I don't think it matters...

Code:

[root@lt2fs3 /]# lsof "root@10.1.1.10"
Any thoughts?

pljvaldez 02-20-2008 06:47 PM

Sorry, I'm not in front of my linux box. I'm a moron, it should be lsof | grep root@10.1.1.10 possibly with the quotes.

EDIT: Just for good measure, here's a good article on using lsof.

carlosinfl 02-20-2008 06:58 PM

Quote:

Originally Posted by pljvaldez (Post 3064348)
Sorry, I'm not in front of my linux box. I'm a moron, it should be lsof | grep root@10.1.1.10 possibly with the quotes.

EDIT: Just for good measure, here's a good article on using lsof.

Thanks for the article on lsof. I get no response on the following command:

Code:

[root@lt2fs3 /]# lsof | grep "root@10.1.1.10"

pljvaldez 02-20-2008 07:00 PM

What if you just grep for "root"

pljvaldez 02-21-2008 11:52 AM

Just out of curiosity, were you able to resolve this?

carlosinfl 02-21-2008 12:12 PM

Nope - nothing seemed to have worked. Its strange. Its there listed as a file but the system can't address it I assume due to the special character in the name so I can't delete it either...sucks!

pljvaldez 02-21-2008 12:22 PM

Can you delete it by inode number? Try ls -il to find out the inode number. Then delete it with find . -inum XXXXXX -exec rm -i {} \; (where XXXXX is the inode number).

rg.viza 02-21-2008 12:56 PM

try lsattr [filename]
if you see an i in there
try chattr -i [filename]
remember to escape the special characters in the file name so you get the name right.

i is the immutable flag

Once you chattr +i a file nothing can be done to it until you chattr -i it.

-Viz

prasanta 02-21-2008 11:18 PM

[QUOTE
-rw-r--r-- 1 root root 19167 Feb 6 13:23 root@10.1.1.10
[/QUOTE]

As per my knowledge, I think that you were trying to do a scp from that machine to 10.1.1.10 and while doing so you have not placed a 'colon' after that. And that's why the file was created. That seems to be a binary file. Being root you should be able to delete it.

Regards,

--
Prasanta

Manuel-H 02-21-2008 11:32 PM

have u tried

rm ./root@10.1.1.10
or
rm ./"root@10.1.1.10"


All times are GMT -5. The time now is 01:55 AM.