Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There is a file under my home area that I cannot delete. When I do an ls -al on the directory, the permissions are ?--------- and there is a ? for user, group, size and date columns. When I attempt to remove it, I get the following error from rm: rm: cannot remove 'file': Invalid argument

Any ideas on a method to remove such an odd file?

share|improve this question
    
Is it open in another process? –  Jeffrey Lin Jan 23 '13 at 20:58
    
Could you show the output of ls -l on the file? What is your filesystem? –  terdon Jan 23 '13 at 20:59
    
@JeffreyLin No process is using it –  steveo225 Jan 23 '13 at 21:10
    
@terdon I mentioned the output of ls -l in the question, I had to use a as well because it is hidden. The filesystem is nfs (surprisingly). If I have access to the server it is mounted from I am going to try and delete it there instead. –  steveo225 Jan 23 '13 at 21:12
    
I wanted the entire output of ls to see if there were any weird characters or encoding issues with the file name (which is not in your question). I have sometimes seen strange things like this when using filenames in greek on a file system that was not UTF8 encoded. In any case, if it is an nfs share it may well be a corruption in the sharing process. Either go to the server or remount it, that might help. –  terdon Jan 23 '13 at 21:16

1 Answer 1

up vote 1 down vote accepted

If the file is on NFS , you will have to login to the server that is serving the filesystem (the file must be local to the server ), then you can run.

lsof | grep -i filename

It should list any processes that are using the file, you can then close the program (if someone on the network has the file open I think there will be an nfsd process listed against the file). Once all processes are closed you should be able to remove the file as necessary either local or remote. If that doesn't work you should be able to rm -rf from the server to force delete it.

share|improve this answer
1  
Even better: lsof filename –  Matthew Lundberg Jan 24 '13 at 1:43
    
oh yeah doh... :P –  Matthew Aldous Jan 24 '13 at 7:19
    
Once I got access to the server. I was able to remove it. Unfortunately, due to my zealousness to remove it, I forgot to check the state of the file on the local system first. Would have been interesting to see if there was a clue to the problem. –  steveo225 Jan 26 '13 at 3:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.