Monday, July 27, 2015

cp overwrite without prompt

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

No comments:

Post a Comment