lslocks Command
Purpose
Displays information about local system file locks that are held by processes.
Syntax
lslocks [ -h ] [ -i ] [ -J ] [ -n ] [ -o list ] [ -p pid ] [ -r ] [ -u ] [ -V ]
Description
The lslocks command displays information about local system file locks that are held by processes. In PowerVC virtual appliance, only read-only inspection of locks is allowed for security. No modification, unlocking, or privileged operations are allowed.
Flags
| Items | Description |
|---|---|
| -h or --help | Displays help about the lslocks command. |
| -i or --noinaccessible | Skips lock entries that cannot be accessed |
| -J or --json | Redirects the results in a JSON format for scripting and automation. |
| -n or --noheadings | Displays the device list without the column headers in a simple format. Then output of this option is ideal for scripting. |
| -o list or --output list | Displays lock information only for the specified columns headings. A list of column headers can be specified separated by commas. For more information about the available column headers, see Column headers. |
| -p pid or --pid pid | Show locks held by the specified process ID. |
| -r or --raw | Displays raw output. The output is not aligned. Only minimum formatting is done to the data. |
| -u or --notruncate | Forces the lslocks command to display the complete information for every column. |
| -V or --version | Displays version information. |
Column headers
The -o parameter is followed by a list of columns that must be displayed in the output. The device information has the following column headings:
| Columns headers | Description |
|---|---|
COMMAND |
Specifies the process name that holds the lock. |
PID |
Specifies the process ID. |
USER |
Specifies the username of the process owner. |
TYPE |
Specifies the lock type. For example, FLOCK (flock), POSIX,
OFDLCK. |
MODE |
Specifies the access mode for the lock. For example, READ,
WRITE. |
M |
Specifies the state of the lock. A value of 0 is for advisory lock and
a value of 1 is for a mandatory lock. |
START |
Specifies the starting byte offset of the lock. |
END |
Specifies the ending byte offset of the lock. A value of * specifies that
the whole file is locked. |
PATH |
Specifies the full path of a locked file. |
DEVICE |
Specifies the major and minor device numbers of the file. |
INODE |
Specifies the inode number of the locked file. |
SIZE |
Specifies the capacity of the locked region. |
Note: If the lslocks command is used without the -o command,
the following columns are displayed in the output:
COMMANDPIDUSERTYPEMODEMSTARTENDPATH
Examples
- To display the default list of all local locks, enter the following
command:
lslocks - To direct the output to a JSON file, enter the following
command:
lslocks -J - To display locks for a specific PID, enter the following
command:
lslocks -p <pid> - To display only the
COMMAND,PID, andPATHcolumns, enter the following command:lslocks -o COMMAND,PID,PATH - To display raw output with complete information and without any column headers, enter the
following command:
lslocks -r -n -u - To display only the accessible locks, enter the following
command:
lslocks -i