Lin Hong's TECH Blog! 刀不磨要生锈,人不学习要落后 - Thinking ahead

How to remove file while happening ‘Text file busy’?

2018-03-10

How to remove file while happening “Text file busy”?

I met the “Text file busy” which I want to delete the unusable file.

How can I fix this problem?

# rm xxxx 
rm: cannot remove xxxx: Text file busy
#

Reason

Other process is using this file now, so you can NOT delete the file before the process release the file. Usually, there error are happening in rm/copy commands.

Solution

The steps are the following.

Check which process is using this file via fuser/lsof command. After get the pid and kill the process via pid.

Example:

# fuser xxxx
/.../xxxx: 10366
# ps -ef | grep  10366

Kill the process via root user.

# kill -9 10366

++++++++++++++++ EOF LinHong ++++++++++++++++


Comments