A file whose existence (or more rarely contents) indicate that a certain resource is in use. Commonly used to implement locking.

Under Unix/Linux , many programs use lockfiles. They are typically placed under /var/lock .

Normally a lock file is erased when the associated resource is freed. Sometimes a lock file stays around, e.g. when the program that made it crashed. Those lock files, which lock something that should no longer be locked, are called stale locks.