How to Force cp Command to Overwrite without Confirmation

October 5, 2021 . 1 MIN READ

cp /usr/share/GeoIP/GeoIP2-Country.mmdb /home/runcloud/webapps/app-staging-com/storage/app/maxmind/GeoIP2-Country.mmdb

 

Usually, when you run a cp command, it overwrites the destination file(s) or directory as shown.

# cp bin/git_pull_frontend.sh test/git_pull_frontend.sh

To run cp in interactive mode so that it prompts you before overwriting an existing file or directory, use the -i flag as shown.

# cp -i bin/git_pull_frontend.sh project1/git_pull_frontend.sh

Resource: https://www.tecmint.com/force-cp-to-overwrite-without-confirmation/

 

Leave a Reply

Your email address will not be published. Required fields are marked *