小编M4r*_*rty的帖子

cp 覆盖 vs rm 然后 cp

当我试图覆盖当前推出的二进制文件,cp无法覆盖,但它可能rm然后它cp。例如:

user@poste:~$ cp binaryFile /tmp
user@poste:~$ sudo cp /tmp/binaryFile binaryFile 
[sudo] password for user:
cp: cannot create regular file `binaryFile`: Text file busy
user@poste:~$ sudo rm binaryFile 
user@poste:~$ sudo cp /tmp/binaryFile  binaryFile 
user@poste:~$ file binaryFile 
binaryFile : ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x7ce005d9eb50e2574246b6a881e625802f7e49f2, not stripped
Run Code Online (Sandbox Code Playgroud)

知道为什么吗?

linux unix bash

18
推荐指数
1
解决办法
3214
查看次数

标签 统计

bash ×1

linux ×1

unix ×1