1753776 Members
7358 Online
108799 Solutions
New Discussion юеВ

rm busy file

 
SOLVED
Go to solution
Cody Godines
Occasional Contributor

rm busy file

Hi,
I have deleted all but one executable in a software's directory that I wanted to delete.

After this:
chmod 000 abaqus_elmd

I do:
rm -f abaqus_elmd

And get back:
abaqus_elmd: 0 mode ? (y/n) y
rm: abaqus_elmd not removed. Text file busy

I don't know if you are going to mention its use, but I do not have the stat() function or script in any of my bins. The only reason I did a chmod was because I read somewhere that it might help. Also, I have already tried:
rm -Rf directoryname

Thanks,
-Cody
6 REPLIES 6
Paula J Frazer-Campbell
Honored Contributor
Solution

Re: rm busy file

HI Cody

Try fuser -u to see who is using it.

fuser -k will kill them
then a rm should work.

HTH

Paula

If you can spell SysAdmin then you is one - anon
Martin Johnson
Honored Contributor

Re: rm busy file

do a /fuser on the file to see if some process has a channel open to it.

Marty
A. Clay Stephenson
Acclaimed Contributor

Re: rm busy file

Hi:

The 'text' term is a little misleading here in that it actually refers to executable instructions (code). You need to first kill the process and then you will be able to remove the file.

Do this:

1) ps -ef | grep abaqus_elmd and note the PID of the process.
2) kill PID
if that fails try kill -11 PID; only as a last resort use kill -9
3) rm abaqus_elmd




If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: rm busy file

Hi Cody,

Use the fuser command
fuser -ku /path/to/command_name
This will list who was using it & kill the process.
Should be able to remove then.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Pete Randall
Outstanding Contributor

Re: rm busy file

Cody,

If it can't be removed at present, you can rename it and then go back later to do the delete.

HTH,
Pete

Pete
MANOJ SRIVASTAVA
Honored Contributor

Re: rm busy file

Hi Cody


There is a sure shot way to do it

ls -li filename

you will get a inode no for that file

do a clri

do a man clri for this ,
then do a fsck on the filesystem , it will ask to remove the file while cleaing the fielsystem.

Manoj Srivastava