LinuxCommandLibrary

lslocks

lists information about all file locks held on the local system

TLDR

List all locks

$ lslocks
copy
List with specific columns
$ lslocks -o PID,COMMAND,PATH
copy
Raw output without headers
$ lslocks --raw --noheadings
copy
List locks for specific PID
$ lslocks --pid [pid]
copy
Output as JSON
$ lslocks --json
copy

SYNOPSIS

lslocks [options]

DESCRIPTION

lslocks lists information about all file locks held on the local system. It shows advisory and mandatory locks, the holding process, and lock details.

PARAMETERS

-o, --output COLUMNS

Specify output columns
-p, --pid PID
Show locks for specific process
-J, --json
JSON output format
-r, --raw
Raw output without formatting
-n, --noheadings
Suppress column headers
-u, --notruncate
Don't truncate output

OUTPUT COLUMNS

COMMAND: Process name
PID: Process ID
TYPE: Lock type (FLOCK, POSIX, LEASE)
SIZE: Size of locked region
PATH: Locked file path

SEE ALSO

flock(1), lsof(8)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community