cp overwrite

cp overwrites files / directories in Linux/Unix.

 

Regular cp ususally overwrites destination files and directories:

$ cp test.c bak

 

To add interactive prompt before overwrite use -i option and press 'y' to overwite:

$ cp -i test.c bak
cp: overwrite 'bak/test.c'? y

 

To avoid overwrite use -n option:

$ cp -n test.c bak

 

To always overwrite without prompt:

$ \cp test.c bak

 

 


See also

Write how to improve this page

CP COMMAND
RAPID TABLES