LSLOCKS(8)
๐ LSLOCKS โ the manual page, but make it make sense
ok so bestie, this is lslocks from section 8 of the manual (that's the system administration girlies section, we love her) ๐
โจ NAME โจ
lslocks โ list local system locks ๐
โจ SYNOPSIS โจ
lslocks [options]
โจ DESCRIPTION โจ
so basically, lslocks spills ALL the tea on every file lock that's currently being held on a Linux system ๐ซโจ. Every. Single. One. It's giving surveillance but make it legal.
โจ OPTIONS โจ
-b,--bytesโ prints sizes in bytes instead of the human-readable version. and btw, the default is sizes in units that are powers of 1024 bytes, and the formal abbreviations for those units (KiB,MiB,GiB, ...) get shortened even further to just their first letter:K,M,G, .... so it's like a lil abbreviation of an abbreviation, very demure ๐ธ-H,--list-columnsโ lists out all the columns you can specify with the--outputoption. and you can pair it with--jsonor--rawif you want that list in a machine-readable format ๐คโจ-i,--noinaccessibleโ ignores lock files that the current user can't access. not your business, not your problem ๐-J,--jsonโ JSON output format. for the data girlies ๐-n,--noheadingsโ no header line. we're skipping the intro, straight to the content ๐ฌ-o,--outputlist โ picks which output columns to print. use--helpif you want the full list of all supported columns.
also!! the default list of columns can be extended if you specify list in the format +list, like this: lslocks -o +BLOCKER. sneaky but iconic ๐
--output-allโ outputs ALL available columns. no crumbs left, we're eating everything ๐ฅ-p,--pidpid โ only shows locks held by the process with this pid.-Q,--filterexpr โ only prints the locks that meet the conditions specified by expr.
๐จ this feature is EXPERIMENTAL. like, it's in its experimental era. also see scols-filter(5).
for example, this one excludes POSIX type locks, but prints all READ mode locks on files with .qcow2 as the extension:
lslocks --filter 'TYPE != "POSIX" and MODE == "READ" and PATH =~ ".*\.qcow2"'
-r,--rawโ uses the raw output format.-u,--notruncateโ does NOT truncate text in columns. we let it breathe, we let it be its full self ๐ฆ-h,--helpโ displays help text and dips out.-V,--versionโ displays version and dips out.
โจ ENVIRONMENT โจ
LIBSMARTCOLS_DEBUG=allโ enableslibsmartcolsdebug output.LIBSMARTCOLS_DEBUG_PADDING=onโ uses visible padding characters.LIBSMARTCOLS_JSON=compact|linesโ controls the JSON output format when you're using--json. supported values arecompactfor JSON output with minimal whitespace, andlinesfor JSON Lines format (one JSON object per line). if it's unset, or set to literally anything else, you get pretty-printed JSON. she has a default and she's sticking to it ๐
โจ OUTPUT โจ
here's every column, bestie, no skips ๐
COMMANDโ the command name of the process holding the lock.PIDโ the process ID of the process.TYPEโ the type of lock. it can beLEASE(created withfcntl(2)),FLOCK(created withflock(2)),POSIX(created withfcntl(2)andlockf(3)) orOFDLCK(created withfcntl(2)). pick your fighter โ๏ธSIZEโ size of the locked file.INODEโ the inode number.MAJ:MINโ the major:minor device number.MODEโ the lock's access permissions (read, write). and if the process is blocked and waiting for the lock, the mode gets postfixed with an'*'(asterisk). the asterisk is literally the "still waiting ๐ญ" of file locks.Mโ whether the lock is mandatory.0means no (which means the lock is only advisory),1means yes. (seefcntl(2).)STARTโ relative byte offset of the lock.ENDโ ending offset of the lock.PATHโ full path of the lock. if none is found, or if there are no permissions to read the path, it falls back to the device's mountpoint and"..."gets appended to the path. also the path might be truncated โ use--notruncateto get the full path, no cuts โ๏ธ๐ซBLOCKERโ the PID of the process which blocks the lock. the villain of the story ๐ฆนHOLDERSโ the holder(s) of the lock. the format of the holder isPID,COMMAND,FD. if a lock is an open file description-oriented lock, there can be more than one holder for the lock. see the NOTES below, bestie, it's important ๐
โจ ENVIRONMENT โจ
yes, again, she has two environment sections, we don't question the queen ๐
LSLOCKS_COLUMNS=โ specifies a comma-separated list of output columns to print. every single column listed by--list-columnscan be used here. the whole menu, go wild ๐
โจ NOTES โจ
ok so the lslocks command is meant to replace the lslk(8) command, which was originally written by Victor A. Abell <abe@purdue.edu> and has been unmaintained since 2001. RIP to a real one ๐ฏ๏ธ
"The process holding the lock" โ for leases, FLOCK locks, and OFD locks โ is a fake-concept. not real, fabricated, a little bit of a lie ๐คฅ. They're actually associated with the open file description on which they are acquired. and with fork(2) and/or cmsg(3), multiple processes can share an open file description. so the holder process of a lease (or a lock) is not uniquely determined. lslocks just shows one of the holder processes in the COMMAND and PID columns. it picked one. it's doing its best ๐ซถ
โ ๏ธ the default output is subject to change. so whenever possible, you should avoid using default output in your scripts. do not trust the default, she's a shapeshifter, she's unpredictable, she's got main character energy ๐
for OFD locks, the PID column may show -1. and those lines cannot be selected by the filter, because the current filter engine does not support negative numbers. sorry, negative numbers, you're not invited to the party ๐
โจ AUTHORS โจ
Davidlohr Bueso <dave@gnu.org> and Christian Goeschel Ndjomouo <cgoesc2@wgu.edu> โ icons, both of them ๐๐
โจ SEE ALSO โจ
flock(1), fcntl(2), lockf(3), scols-filter(5)
โจ REPORTING BUGS โจ
for bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>. tell them everything, don't gatekeep ๐
โจ AVAILABILITY โจ
the lslocks command is part of the util-linux package, which can be downloaded from the Linux Kernel Archive at <https://www.kernel.org/pub/linux/utils/util-linux/>. go get your girl โจ
okay that's the whole thing, no notes, you ate this one fr fr ๐ โจ
this was util-linux 2.42.4, dated 2026-09-21, and it's the LSLOCKS(8) page โ mwah, sending you love, go lock some files responsibly ๐๐
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms