Sample Header Ad - 728x90

What precisely does cp -b (--backup) actually do?

4 votes
2 answers
7350 views
Before you hit me with the obvious, I know, the backup option makes a backup of a file. But the thing is, the cp command in general backs up a file. One could argue a copy of a file is a backup. So more precisely, my question is this: what does the -b option do that the cp command doesn't do already? The cp(1) man page gives the following description of the --backup option: > make a backup of each existing destination file This definition isn't very useful, basically saying "the backup option makes a backup". This gives no indication as to what -b adds to the cp I know -b puts some suffix at the end of the name of the new file. But is there anything else it does? Or is that it? Is a -b backup just a cp command that adds something to the end of the filename? P.S. Do you typically use -b when making backups in your daily work? Or do you just stick to -a?
Asked by backslash enn (43 rep)
Feb 1, 2023, 05:44 PM
Last activity: Mar 1, 2025, 02:51 PM