Use of Linux ipcs command

Use of Linux ipcs command

1. Command Introduction

The ipcs command is used to report the status of inter-process communication facilities in Linux. The displayed information includes message lists, shared memory, and semaphore information. It can help developers locate problems in inter-process communication.

2. Command format

ipcs [resource-option] [output-format]
ipcs [resource-option] -i id

3. Command Options

-i, --id [id]: Display detailed IPC information of the specified resource ID. You need to specify the resource type when using it. Resources include message queues (-q), shared memory (-m), and semaphores (-s).
-h, --help: Display help information -V, --version: Display version information IPC resource type options:
-q, --queues: Display active message queue information -m, --shmems: Display active shared memory information -s, --semaphores: Display active semaphore information -a, --all: Display all IPC information in the system. The default output format options for the command: When multiple options are specified, the last one takes precedence.
-c, --creator: View the creator and owner of the IPC -l, --limits: View the limit information of the IPC resource -p, --pid: View the process ID of the creator and last operator of the IPC resource
-t, --time: View the detailed time of the latest call to IPC resources. This includes operations on message queues using msgsnd() and msgrcv(), operations on shared memory using shmat() and shmdt(), and operations on semaphores using semop().
-u, --summary: View the IPC resource status summary information. Display size unit control options: Only effective for option -l (--limits).
-b, --bytes: Display size in bytes --human: Display size in human readable format

4. Common Examples

(1) Display all IPC information.

[root@TENCENT64 /]# ipcs
------ Message Queues --------
key msqid owner perms used-bytes messages  

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status   
0x6674431e 0 root 600 50485760 9

------ Semaphore Arrays --------
key semid owner perms nsems   
0x0000870a 0 root 666 1

(2) Display information about the specified shared memory ID.

[root@TENCENT64 /]# ipcs -m -i 32769

Shared memory Segment shmid=32769
uid=0 gid=0 cuid=0 cgid=0
mode=0666 access_perms=0666
bytes=12000 lpid=2784 cpid=1077 nattch=3
att_time=Thu Dec 27 10:39:32 2018 
det_time=Thu Dec 27 10:39:32 2018 
change_time=Fri Jul 20 13:17:41 2018

(3) Check the process ID of the creator and the last operator of the IPC.

------ Message Queues PIDs --------
msqid owner lspid lrpid   

------ Shared Memory Creator/Last-op PIDs --------
shmid owner cpid lpid   
0 root 702 23364   
32769 root 702 5296

Among them, lspid represents the "process number" of the last message sent to the message queue, and lrpid corresponds to the "process number" of the last message read from the message queue. But please note: the process number here is a weak process number, that is, it may represent the thread number. If the thread in the process sends and receives messages to the message queue, the pid here corresponds to the thread number. You can use ps -AL | grep pid to find the process id corresponding to the thread.

The above is the detailed content of the use of Linux ipcs command. For more information about Linux ipcs command, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed Tutorial on Using xargs Command on Linux
  • Use of Linux tr command
  • Linux sar command usage and code example analysis
  • Use of Linux ls command
  • Use of Linux sed command
  • Use of Linux read command
  • Use of Linux usermod command
  • Use of Linux passwd command
  • Detailed explanation of the use of Linux time command
  • Use of Linux ln command
  • Use of Linux telnet command

<<:  Vue+element implements drop-down menu with local search function example

>>:  Detailed analysis of MySQL optimization of like and = performance

Recommend

Vue implementation example using Google Recaptcha verification

In our recent project, we need to use Google robo...

Detailed examples of Docker-compose networks

Today I experimented with the network settings un...

Native JavaScript implementation of progress bar

The specific code for JavaScript to implement the...

Do you know how many connections a Linux server can handle?

Preface First, let's see how to identify a TC...

Vue implements user login and token verification

In the case of complete separation of the front-e...

How to fix the four sides of the table to scroll up, down, left and right

question: When I was doing project statistics rec...

Front-end state management (Part 2)

Table of contents 1. Redux 1.1. Store (librarian)...

Front-end JavaScript thoroughly understands function currying

Table of contents 1. What is currying 2. Uses of ...

How to update v-for in Vue

Tips: Array change method will cause v-for to upd...

Introduction to local components in Vue

In Vue, we can define (register) local components...

MySQL 8.0 WITH query details

Table of contents Learning about WITH queries in ...

Some indicators of excellent web front-end design

The accessibility of web pages seems to be somethi...

Example of how to upload a Docker image to a private repository

The image can be easily pushed directly to the Do...