lslocks: command not found

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.

If you encounter the below error while running the command lslocks:

lslocks: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install util-linux
Ubuntu apt-get install util-linux
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install util-linux
CentOS yum install util-linux
Fedora dnf install util-linux
OS X brew install util-linux
Raspbian apt-get install util-linux

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