Ubuntu 中的 cp 命令不会覆盖现有文件

cp command in Ubuntu does not overwrite the existing file

我是运行以下命令:

sudo cp /srv/site/pro/config/test.env /srv/site/.env

但是,如果文件 /srv/site/.env 已经存在,它似乎不会被覆盖。

如何确保命令覆盖现有文件?

cp --forcecp -f 请同时阅读 cp 的手册页:http://unixhelp.ed.ac.uk/CGI/man-cgi?cp