ipcs命令詳解
ipcs是Linux下顯示程序間通訊設施狀態的工具。可以顯示訊息佇列、共享記憶體和訊號量的資訊。對於程式設計師非常有用,普通的系統管理員一般用不到此指令。
ipcs shows information on the inter-process communication facilities for which the calling process has read access.By default it shows information about all three resources: shared memory segments, message queues, and semaphore arrays.
Without options, information shall be written in short format for message queues, shared memory segments, and semaphore sets that are currently active in the system. Otherwise, the information that is displayed is controlled by the options specified.-q : Write information about active message queues. -m : Write information about active shared memory segments. -s : Write information about active semaphore sets. -a, --allall (default)
------ Message Queues -------- keymsqidownerpermsused-bytesmessages root@52coder:~# ipcs -m ------ Shared Memory Segments -------- keyshmidownerpermsbytesnattchstatus root@52coder:~# ipcs -s ------ Semaphore Arrays -------- keysemidownerpermsnsems root@52coder:~#
-c : Write creator’s user name and group name;.
-p : Write process number information. (Process ID of the last process to send a message and process ID of the last process to receive a message on message queues, process ID of the creating process, and process ID of the last process to attach or detach on shared memory segments.)
-t : Write time information. (Time of the last control operation that changed the access permissions for all facilities, time of the last msgsnd() and msgrcv() operations on message queues, time of the last shmat() and shmdt() operations on shared memory, and time of the last semop() operation on semaphores.)root@52coder:~# ipcs -c ------ Message Queues Creators/Owners -------- msqidpermscuidcgiduidgid ------ Shared Memory Segment Creators/Owners -------- shmidpermscuidcgiduidgid ------ Semaphore Arrays Creators/Owners -------- semidpermscuidcgiduidgid root@52coder:~# root@52coder:~# root@52coder:~# root@52coder:~# ipcs -p ------ Message Queues PIDs -------- msqidownerlspidlrpid ------ Shared Memory Creator/Last-op PIDs -------- shmidownercpidlpid root@52coder:~# ipcs -t ------ Message Queues Send/Recv/Change Times -------- msqidownersendrecvchange ------ Shared Memory Attach/Detach/Change Times -------- shmidownerattacheddetachedchanged ------ Semaphore Operation/Change Times -------- semidownerlast-oplast-changed root@52coder:~# root@52coder:~# ipcs --help Usage: ipcs [resource-option...] [output-option] ipcs -m|-q|-s -i <id> Show information on IPC facilities. Options: -i, --id <id>print details on resource identified by <id> -h, --helpdisplay this help -V, --versiondisplay version Resource options: -m, --shmemsshared memory segments -q, --queuesmessage queues -s, --semaphoressemaphores -a, --allall (default) Output options: -t, --timeshow attach, detach and change times -p, --pidshow PIDs of creator and last operator -c, --creatorshow creator and owner -l, --limitsshow resource limits -u, --summaryshow status summary --humanshow sizes in human-readable format -b, --bytesshow sizes in bytes For more details see ipcs(1).