Next: , Previous: Exit status, Up: Common options


2.2 Backup options

Some GNU programs (at least cp, install, ln, and mv) optionally make backups of files before writing new versions. These options control the details of these backups. The options are also briefly mentioned in the descriptions of the particular programs.

-b
--backup[=method]
Make a backup of each file that would otherwise be overwritten or removed. Without this option, the original versions are destroyed. Use method to determine the type of backups to make. When this option is used but method is not specified, then the value of the VERSION_CONTROL environment variable is used. And if VERSION_CONTROL is not set, the default backup type is ‘existing’.

Note that the short form of this option, -b does not accept any argument. Using -b is equivalent to using --backup=existing.

This option corresponds to the Emacs variable ‘version-control’; the values for method are the same as those used in Emacs. This option also accepts more descriptive names. The valid methods are (unique abbreviations are accepted):

none
off
Never make backups.
numbered
t
Always make numbered backups.
existing
nil
Make numbered backups of files that already have them, simple backups of the others.
simple
never
Always make simple backups. Please note ‘never’ is not to be confused with ‘none’.

-S suffix
--suffix=suffix
Append suffix to each backup file made with -b. If this option is not specified, the value of the SIMPLE_BACKUP_SUFFIX environment variable is used. And if SIMPLE_BACKUP_SUFFIX is not set, the default is ‘~’, just as in Emacs.