.keep file

From Gentoo Wiki
Jump to: navigation, search

In Gentoo, files with the name .keep (and files with the ".keep-" prefix) are found in some directories. They should not be deleted.

These directories are necessary, but often empty, especially at their creation time. Unmerge deletes empty directories, and ".keep" files make sure these directories will be kept to remain.

More specifically, there're two variants: The files with the name .keep are created by stage tarballs.

Packages can create ".keep" files, too. In this case they will be named
.keep_<category>_<package>-<slot>.

Example:

  • /var/log/portage/elog/.keep_sys-apps_portage-0

(Packages have the default slot number "0".)

Packages create ".keep" files by the ebuild helper function "keepdir". See the description by:

user $man 5 ebuild