Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried to delete a directory by running sudo rm -rf google-chrome. This gave no output message but the directory wasn't deleted. There is only one file remaining, google-chrome/default/User\ StyleSheets/Custom.css.

I tried to cd to the User\ Stylesheets directory and remove the file but that didn't work.

I ran sudo rm Custom.css, but the file wasn't deleted (and no output from rm).

How can I delete it?

More info:
ls -la Custom.css gives

    -rw-rw-r-- 1 david david 0 Oct 21 02:42 Custom.css

lsattr Custom.css gives

    -------------e- Custom.css

(the immutable bit is not set)

share|improve this question

2 Answers 2

Most likely some process is holding the file open and/or immediately recreating it when you delete it. Try the following command:

sudo lsof google-chrome/default/User\ StyleSheets/Custom.css

This should tell you what program is locking the file. You may then kill it, and (hopefully) delete the file. Failing that, a reboot should fix it good.

share|improve this answer
    
I got this output from lsof: lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/david/.gvfs Output information may be incomplete. –  David Robertson Oct 21 '12 at 2:28
    
Rebooting seems to have solved it though. Thanks :) –  David Robertson Oct 21 '12 at 2:35
    
Ah, root can't look into your gvfs, so try without sudo. However, since the file wasn't in that folder, it probably wouldn't have worked anyway. –  Alistair Buxton Oct 21 '12 at 3:07

I often have the same problem using chromium on Debian Testing. The Custom.css file was indeed blocked by a running program but lsof wouldn't let me know of it. So I just made a:

ps -aux | grep chromium

Which gave me the list of all running chromium instances, and there were 3 or 4! After killing them all I could just remove the Custom.css file without a problem.

share|improve this answer

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.