lslocks Command Examples in Linux

lslocks is a Linux command that displays information about current file locks held by processes on the local system. It provides a list of file locks and the processes holding them, including the PID, the name of the process, the type of lock, the device and inode number of the locked file, and the path to the locked file. The information provided by lslocks can be useful in diagnosing issues with file locking and determining which processes are holding locks on specific files.

lslocks Command Examples

1. List all local system locks:

# lslocks

2. List locks with defined column headers:

# lslocks --output PID,COMMAND,PATH

3. List locks producing a raw output (no columns), and without column headers:

# lslocks --raw --noheadings

4. List locks by PID input:

# lslocks --pid PID

5. List locks with JSON output to stdout:

# lslocks --json
Related Post