.LOCK

LOCK File

Ask a question
QUICK ANSWER

A .lock file is a marker that a program is actively using a file, database, or profile. It is usually empty or holds a tiny text note such as a process ID. You do not open or edit it. If an app crashed and left a stale .lock that blocks you, close the program fully and delete the file.

Developer: N/A (generic OS/application convention) Category: Misc Files MIME: application/octet-stream
OPENS ON Windows macOS Linux
Related: .TORRENT · .MSO · .MD5 · .SHS

On this page

19k+ extensions indexed
Last reviewed Jul 29, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the LOCK file format?

A .lock file is used to lock a resource or file, supported by various operating systems and programs. When files or resources are accessed concurrently by multiple processes or users, the .lock file signals other applications to wait until the resource is released. The .lock file is typically an empty (zero-byte) file; however, it can contain a short plain-text payload - such as a process ID (PID), hostname, username, or timestamp - depending on which application created it. .lock files are widely supported on Linux, macOS, Windows, and other platforms, going well beyond the early Unix-based systems where the convention originated.

There is no fixed internal format or magic number; the file's mere existence indicates the resource is in use. A second important application of .lock is in modern package managers: tools like npm (package-lock.json), Yarn (yarn.lock), Cargo (Cargo.lock), and Bundler (Gemfile.lock) write structured dependency manifests under this same extension to pin exact versions and ensure reproducible builds.

Related formats include .tmp temporary files and .pid process-ID files, which serve similar operational roles.

Security & safety

RISK: LOW

A .lock file is inert - it cannot run and usually contains nothing. The only real risk is deleting one while the owning program is genuinely active, which can cause two processes to write the same database/file simultaneously and corrupt it. Always close/verify the owning app first. A .lock left behind by ransomware-style malware is a different thing entirely (it marks an encrypted file); if .lock files appear suddenly on many personal documents, treat it as a possible ransomware indicator, not a normal lock.

Format details

in a nutshell
FULL NAMELock Fileaka lockfile, exclusive-access marker
DEVELOPERN/A (generic OS/application convention)since Long-standing Unix convention (1970s-1980s); used across many OSes and apps
CATEGORYMisc Files
MIME TYPEapplication/octet-stream
TYPEMarker/sentinel file - usually empty or a tiny text stub (no fixed format)
This extension is also used by…
  • Package-manager dependency lock file - Files like Cargo.lock, Gemfile.lock, yarn.lock, poetry.lock, flake.lock pin exact dependency versions - real, editable text manifests, not empty markers.
  • Application profile/session lock - Browsers and apps (e.g. Firefox profile .parentlock, LibreOffice .~lock files) create a lock to stop a second instance opening the same profile/document.

Programs that open LOCK files

Windows2 apps
Windows Notepad Built-in Right-click -> Open with -> Notepad only to peek at any text (PID/owner); most are empty. Don't keep it open.
Notepad Open-source Open the .lock as plain text to read any embedded PID/path; useful for diagnosing stale locks.
macOS1 app
TextEdit Built-in Open the .lock as plain text to inspect any payload; usually it's empty.
Linux1 app
Any text editor (gedit, nano, less) Open-source 'cat file.lock' or open in an editor to read a PID/owner; 'lsof'/'fuser' show which process holds it.

Technical details

deep spec
Mechanism typeAdvisory (cooperative) locking: applications must voluntarily check for the file; the OS does not enforce exclusion
Lock signalMere existence of the file indicates the resource is held - no contents required
Typical file size0 bytes to a few KB; the vast majority are 0 bytes (empty sentinel)
Body encodingEmpty, or plain-text ASCII/UTF-8 - PID, hostname, username, file path, or timestamp
Magic bytes / headerNone - no magic number or fixed header; identified by name and extension only
Platform supportLinux, Unix, macOS, Windows; cross-platform by convention
LifecycleCreated by the owning process when it acquires the resource; deleted on clean release
Stale lock riskIf the owning process crashes without cleanup, the .lock file must be manually removed to restore access
Structured variantPackage manager manifests (package-lock.json, Gemfile.lock, Cargo.lock, yarn.lock, poetry.lock) share the extension but contain structured dependency data
Common applicationsText editors (LibreOffice, vim), databases (SQLite), browsers (Firefox profile), package managers (npm, Yarn, Bundler, Cargo, Poetry)
OS-level alternativeflock/fcntl on Unix, LockFileEx on Windows - often used alongside lock files for stronger guarantees
MIME typeapplication/octet-stream (empty/binary) or text/plain (text payload)
ReleasedLong-standing Unix convention (1970s-1980s); used across many OSes and apps
Latest versionN/A - no single specification; meaning is defined per application

LOCK conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with LOCK files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about LOCK files.

Frequently asked questions

What is a .lock file and can I open it?
It's a marker that a program is using a resource. There's usually nothing inside to open - it may be empty or hold a small text note (a PID/owner). You can peek with a text editor, but it isn't meant to be opened.
Is it safe to delete a .lock file?
Yes, if the program that created it is fully closed/not running - that clears a stale lock. Deleting one while the app is actively using the resource can corrupt the underlying file or database.
An app says the file is locked and won't open - how do I fix it?
Close every copy of the program (and check Task Manager/ps for leftover processes), then delete the orphaned .lock file next to the document/database and reopen.
Why does a .lock keep coming back?
Because the program recreates it every time it opens the resource - that's normal. It should disappear when the app closes cleanly; if it persists, the app likely crashed or is still running in the background.
Should I commit Cargo.lock / yarn.lock / Gemfile.lock to git?
Those are dependency lock files (a different use of .lock) - real text manifests pinning versions. For applications you generally commit them; for libraries the convention varies by ecosystem.
Lots of my documents suddenly have a .lock added - is that ransomware?
Possibly. Some ransomware appends .lock to encrypted files. Normal locks sit next to a file in use, not on dozens of personal documents at once. Disconnect and scan if files also won't open.

References

1Wikipedia - File locking (advisory vs mandatory)en.wikipedia.org
2Linux man pages - flock(2) / lockfile conventionsman7.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.JPGJPEG Image
4.PARTPartial Download File
5.MDMarkdown Document
6.BINCD/DVD Disc Image (BIN/CUE)
7.EXEWindows Executable (Portable Executable)
8.DATProgram Data File (generic)
9.RPMSGRestricted Permission Message
10.DBSQLite Database File

Related extensions

.TORRENTBitTorrent Metainfo File
.MSOMicrosoft Office HTML/OLE Data Stream (oledata.mso)
.MD5MD5 Checksum File
.SHSShell Scrap Object File
.DDDAdobe Acrobat Distiller file
.DWLDrawing Lock File (CAD)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z