2

Example: /etc/group-, /etc/passwd-

Is there any motivation behind choice of the - sign (e.g. easier to recognize, process, etc.)?

4
  • 3
    For what it's worth, I don't think that convention is widespread at all. This may be quite idiosyncratic to /etc/passwd and friends. Similar conventions that are widespread are filename~ (for backups, convention from emacs) and filename-- (something intentionally disabled by the sysadmin). Commented Jan 22, 2015 at 7:09
  • 1
    Some unix systems have the old passwd backupped as opasswd Commented Jan 22, 2015 at 7:41
  • 1
    @wurtel. Backup is a noun (as is setup and login). In each case, the verb form is two words, a prepositional verb: hence back up, or, in the past tense, backed up. You may find your English flows more smoothly if you follow these guidelines, and you will not have to create monstrosities such as *backupped. Commented Jan 22, 2015 at 12:51
  • @Celada my filename-- is a newer backup of filename, because filename- is already taken by an older backup. Commented Nov 4, 2020 at 9:30

1 Answer 1

7

Using prefixes or suffixes is common, because it's easily filtered.

It's usually ~ for backup. Most text editors use this, and it is possible to explicitly tell ls to not list them by default. This is similar to using a period at the beginning to make the file somewhat hidden (this is also respected by ls and by shell globbing). Other examples are #filename# used by emacs for storing unsaved modifications of a file (so that you can recover if you didn't save something). This one is usually meant as temporary file (not exactly backup) and is usually shown by file listing tools.

The usage of - in the case of user account management files is somewhat unconventional (I don't recall any other occurences of this suffix). It may be from the prehistoric versions of unix (someone should comment if they know). However there is a subtle difference here. The ~ mostly means that a user modified a file and a backup was stored by the text editor. The - suffix is used by the automatic tools for user management. It's not there so much to reverse syntax errors or file corruptions, but to revert a correct (but unwanted) change. It's not uncommon to have both files present if you happened to edit the files by hand at some point. For instance, I sometimes have 3 extra files:

passwd, passwd~, passwd-, passwd.pacnew 

the last one is a custom suffix used by pacman to store a file to be carefully merged into the existing file by hand.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.