#Bash 的 lsipc 命令
lsipc [OPTION]...
功能
列出进程间通信(IPC)设施的信息。
类型
可执行文件(/usr/bin/lsipc),属于 util-linux。
参数
OPTION选项:-i,--id id- 要查看的资源 ID-g,--global- 查看系统范围内的所有 IPC 资源使用情况和限制-m,--shmems- 仅查看共享内存-q,--queues- 仅查看消息队列-s,--semaphores- 仅查看信号量组-c,--creator- 显示资源的创建者和所有者-e,--export- 以键值对(key="value")的格式输出-J,--json- 以 JSON 格式输出-l,--list- 以列表格式输出(默认)-n,--newline- 每条信息单独显示一行--noheadings- 不显示标题行(列名)--notruncate- 不要截断输出-o,--output list- 指定要显示的 列名,用逗号分隔-b,--bytes- 以字节作为单位-r,--raw- 以原始格式输出-t,--time- 显示时间信息--time-format type- 指定时间格式-P,--numeric-perms- 显示权限-y,--shell- 使列名只包含 SHELL 变量标识符允许的字符--help- 显示当前帮助--version- 显示版本
返回值
- 0 - 成功
- 1 - 参数错误
- 2 - 严重错误
#列名
#通用列
KEY- 资源的 keyID- 资源的 IDOWNER- 所有者的用户名或 UIDPERMS- 权限CUID- 创建者的 UIDCUSER- 创建者用户CGID- 创建者的 GIDCGROUP- 创建者组UID- 用户 IDUSER- 用户名GID- 组 IDGROUP- 组名CTIME- 最后变更时间
#共享内存(--shmems)的列
SIZE- 分段大小NATTCH- 附加进程数量STATUS- 状态ATTACH- 附加时间DETACH- 分离时间COMMAND- 创建者命令行CPID- 创建者的 PIDLPID- 最后一个用户的 PID
#消息队列(--queues)的列
USEDBYTES- 使用的字节数MSGS- 消息数量SEND- 最后发送消息的时间RECV- 最后接收消息的时间LSPID- 最后发送消息者的 PIDLRPID- 最后接收消息者的 PID
#信号量(--semaphores)的列
NSEMS- 信号量的数量OTIME- 最后一次操作的时间
#摘要(--global)的列
RESOURCE- 资源名称DESCRIPTION- 资源描述LIMIT- 系统范围限制USED- 当前占用USE%- 当前占用百分比
#示例
$ lsipc
RESOURCE DESCRIPTION LIMIT USED USE%
MSGMNI Number of message queues 32000 0 0.00%
MSGMAX Max size of message (bytes) 8K - -
MSGMNB Default max size of queue (bytes) 16K - -
SHMMNI Shared memory segments 4096 0 0.00%
SHMALL Shared memory pages 18446744073692774399 0 0.00%
SHMMAX Max size of shared memory segment (bytes) 16E - -
SHMMIN Min size of shared memory segment (bytes) 1B - -
SEMMNI Number of semaphore identifiers 32000 0 0.00%
SEMMNS Total number of semaphores 1024000000 0 0.00%
SEMMSL Max semaphores per semaphore set. 32000 - -
SEMOPM Max number of operations per semop(2) 500 - -
SEMVMX Semaphore max value 32767 - -
#推荐阅读
#手册
LSIPC(1) User Commands LSIPC(1)
NAME
lsipc - show information on IPC facilities currently employed in the
system
SYNOPSIS
lsipc [options]
DESCRIPTION
lsipc shows information on the System V inter-process communication
facilities for which the calling process has read access.
OPTIONS
-i, --id id
Show full details on just the one resource element identified by
id. This option needs to be combined with one of the three resource
options: -m, -q or -s. It is possible to override the default
output format for this option with the --list, --raw, --json or
--export option.
-g, --global
Show system-wide usage and limits of IPC resources. This option may
be combined with one of the three resource options: -m, -q or -s.
The default is to show information about all resources.
-h, --help
Display help text and exit.
-V, --version
Print version and exit.
Resource options
-m, --shmems
Write information about active shared memory segments.
-q, --queues
Write information about active message queues.
-s, --semaphores
Write information about active semaphore sets.
Output formatting
-c, --creator
Show creator and owner.
-e, --export
Produce output in the form of key="value" pairs. All potentially
unsafe value characters are hex-escaped (\x<code>). See also option
--shell.
-J, --json
Use the JSON output format.
-l, --list
Use the list output format. This is the default, except when --id
is used.
-n, --newline
Display each piece of information on a separate line.
--noheadings
Do not print a header line.
--notruncate
Don’t truncate output.
-o, --output list
Specify which output columns to print. Use --help to get a list of
all supported columns.
-b, --bytes
Print size in bytes rather than in human readable format.
-r, --raw
Raw output (no columnation).
-t, --time
Write time information. The time of the last control operation that
changed the access permissions for all facilities, the time of the
last msgsnd(2) and msgrcv(2) operations on message queues, the time
of the last shmat(2) and shmdt(2) operations on shared memory, and
the time of the last semop(2) operation on semaphores.
--time-format type
Display dates in short, full or iso format. The default is short,
this time format is designed to be space efficient and human
readable.
-P, --numeric-perms
Print numeric permissions in PERMS column.
-y, --shell
The column name will be modified to contain only characters allowed
for shell variable identifiers. This is usable, for example, with
--export. Note that this feature has been automatically enabled for
--export in version 2.37, but due to compatibility issues, now it’s
necessary to request this behavior by --shell.
EXIT STATUS
0
if OK,
1
if incorrect arguments specified,
2
if a serious error occurs.
HISTORY
The lsipc utility is inspired by the ipcs(1) utility.
AUTHORS
Ondrej Oprala <ooprala@redhat.com>, Karel Zak <kzak@redhat.com>
SEE ALSO
ipcmk(1), ipcrm(1), msgrcv(2), msgsnd(2), semget(2), semop(2),
shmat(2), shmdt(2), shmget(2), sysvipc(7)
REPORTING BUGS
For bug reports, use the issue tracker at
https://github.com/util-linux/util-linux/issues.
AVAILABILITY
The lsipc command is part of the util-linux package which can be
downloaded from Linux Kernel Archive
<https://www.kernel.org/pub/linux/utils/util-linux/>.
util-linux 2.39.3 2023-10-23 LSIPC(1)