关于Linux的拷贝命令我们都知道cp的参数 -f的意思是:
-f, --force if an existing destination file cannot be opened, remove it and try again
也就是说-f可以覆盖目的目录下有的文件,
但你有没有发现过这种情况,即使使用了-f也无法覆盖?
原因何在呢?
默认cp命令是有别名(alias cp='cp -i')的,无法强制覆盖,即使你用 -f 参数也无法强制覆盖文件。
可以使用\cp 执行cp命令时不走alias
\cp * -rf ../../test
网上还有一种解决方法:
临时取消cp的alias
#unalias cp
#cp a /test/a