• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lslocks Command Examples in Linux

by Deepika

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

Filed Under: Linux

Some more articles you might also be interested in …

  1. chown Command Examples in Linux
  2. Difference between soft links and hard links in Linux
  3. How to automate sftp file transfers using expect utility
  4. kill Command Examples in Linux
  5. How to find which rpm package provides a specific file or library in RHEL / CentOS
  6. helix Command Examples
  7. lsattr: command not found
  8. resize2fs: commnd not found
  9. CentOS / RHEL : How to Recover from deleted /etc/passwd file
  10. CentOS / RHEL : How to Change the login shell of the user

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright