What Is a .~lock File?
LibreOffice left a .~lock file and now warns the document is “locked for editing”. It is just a lock marker. Here is what it does and how to clear a stale one.
What a .~lock file is
A .~lock file is a lock file LibreOffice (and OpenOffice) creates the moment you open a document. Its full name is .~lock.<filename># — for example .~lock.Report.odt# — and it sits in the same folder as the document. Because the name starts with a dot it is hidden on Linux and macOS.
Why it exists
The lock file tells any other LibreOffice session that the document is already open, so two windows or two people can't overwrite each other's edits. It stores the user name, host and a timestamp. When you close the document normally, LibreOffice deletes the .~lock file automatically.
“Document is locked for editing”
If you see “Document is locked for editing by another user” but nobody else has it open, a stale .~lock was left behind after a crash or a force-quit. The document itself is fine.
Is it safe to delete?
Yes — when the document is closed everywhere. Close LibreOffice on every machine that might hold the file, then delete the orphaned .~lock.<name># file. The next time you open the document a fresh lock is created.
How to handle it by OS
Linux / macOS: the file is hidden; show hidden files (Ctrl+H in most file managers, or ls -a) to see and remove it.
Windows: LibreOffice uses the same lock files; they appear as .~lock.name# next to the document and can be deleted once the app is closed.
Common problem
A network share or cloud-sync folder can keep a lock alive after a crash. If the warning persists, make sure no sync client still has the file open, then delete the lock.
Who is holding the lock? Read the file
The .~lock file is plain text. Before you force anything, open it to see exactly who has the document — this tells you whether a real second session exists or the lock is just stale.
Linux / macOS: cat .~lock.Report.odt#
Windows (PowerShell): Get-Content ".~lock.Report.odt#"
You will see comma-separated fields: the user name, the host/computer name, the date-time it was locked, and a lock type. If the host is your own machine and no LibreOffice is running, the lock is stale and safe to remove. If it names another person’s machine, ask them to close the document first.
The “locked for editing” dialog: which button?
When LibreOffice finds a lock it offers three choices:
- Open Read-Only — safest. You can read and copy but not save over the original. Use this if someone else genuinely has it open.
- Open Copy — opens an editable duplicate you save under a new name. Best when you need to work now but are unsure the lock is stale.
- Open anyway / Ignore lock — only safe when you have confirmed (by reading the lock file above) that no other session is really editing. Two sessions saving at once can lose edits.
Network share / NFS: the stubborn case
On SMB, NFS or a cloud-sync folder a lock can survive a crash because the server never saw the client close. Steps: (1) confirm every client that mounts the share has LibreOffice closed; (2) read the lock file to see which host owns it; (3) delete the orphaned .~lock on the share itself, not a cached copy. If locks keep reappearing on an unreliable share, LibreOffice has a setting (Tools → Options → Load/Save → General) but the supported fix is to resolve the mount, not to disable locking — disabled locking is what causes silent overwrites in the first place.
Prevention
Always close documents before shutting down or disconnecting a network drive, and let LibreOffice quit fully (watch for a lingering soffice.bin process) so it can delete its own lock. On shared drives, agree that one person edits at a time, or use the file’s version history instead of simultaneous edits.
FAQ
What is a .~lock file in LibreOffice?
It is a hidden lock file LibreOffice creates while a document is open, to stop two sessions editing the same file at once.
Is it safe to delete a .~lock file?
Yes, once the document is closed everywhere. Deleting an orphaned lock clears the 'locked for editing' warning.
Why does it say the document is locked when no one has it open?
A stale .~lock was left after a crash. Close LibreOffice on all machines and delete the leftover lock file.
Where is the .~lock file stored?
In the same folder as the document, named .~lock.<filename>#, hidden because the name starts with a dot.
Will deleting the lock file damage my document?
No. The lock file contains no document data — only who has it open. Your .odt or .docx is untouched.
How do I find out who has a LibreOffice document locked?
Open the .~lock file in a text editor (cat on Linux/macOS, Get-Content in PowerShell). It lists the user name, host machine and timestamp of whoever opened the document.
Should I click Open Read-Only, Open Copy, or Open anyway?
Open Read-Only if someone really has it open; Open Copy to work on a duplicate when unsure; Open anyway only after confirming from the lock file that no other session is editing, since two writers can lose edits.
Other file types explained
- Recover an Unsaved File in VS Code After Closing or a Crash
- Is a .crdownload File Safe to Delete? (Unfinished Chrome Downloads)
- .swp vs .swo — What's the Difference? (Vim Swap Files)
- Are .bak Files Safe to Delete? (Backup Files)
- What Is a .ORIG File?
- What Is a .!QB File?
- What Is a .SAV File?
- What Is a .CACHE File?