Ubuntu – The “-” at the end of some files


I find a lot of the time that files in /etc end with a -, but have another version of the file without it at the end. So what does the - mean? Is it like a ~? Or does it serve a different purpose?

Best Answer

  • $ ls /etc/*-
    /etc/group-    /etc/passwd-  /etc/subgid-
    /etc/gshadow-  /etc/shadow-  /etc/subuid-

    These are just backup files. For example /etc/passwd has its backup file with name /etc/passwd- and so on.

    When programs like useradd, usermod etc. (who has to edit those files) edits them keep a backup copy with - appended at the end.