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 --output option. and you can pair it with --json or --raw if 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, --output list โ€” picks which output columns to print. use --help if 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, --pid pid โ€” only shows locks held by the process with this pid.
  • -Q, --filter expr โ€” 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 โ€” enables libsmartcols debug 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 are compact for JSON output with minimal whitespace, and lines for 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 be LEASE (created with fcntl(2)), FLOCK (created with flock(2)), POSIX (created with fcntl(2) and lockf(3)) or OFDLCK (created with fcntl(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. 0 means no (which means the lock is only advisory), 1 means yes. (see fcntl(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 --notruncate to 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 is PID,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-columns can 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