Sample Header Ad - 728x90

Can't overwrite a file by moving another over it

1 vote
2 answers
1973 views
I have file /some/foo which is a plain text file. I can edit it with vim and I can cat something else to it. But whenever I try to automate the editing process with sed, it says sed: cannot move '/some/sedGl29Uj': Device or resource busy I tried redirecting sed's output to a temporary file and cat, it's OK. But if I try to move the temporary file onto it, it will say root@localhost:/some # mv tmp foo mv: Device or resource busy I'm quite concerned why vim and cat can write the file but mv can't. Ubuntu 16.04.1 LTS. /some is a subfolder of / (root mount point, ext4).
Asked by iBug (3638 rep)
Apr 23, 2017, 02:45 PM
Last activity: Jun 24, 2023, 03:03 PM