ipcs Command Examples in Linux

By default, each process running on the Linux system has its own private memory pages. One process cannot access memory pages being used by another process. The kernel maintains its own memory areas. For security purposes, no processes can access memory used by the kernel processes. To facilitate data sharing, you can create shared memory pages. Multiple processes can read and write to and from a common shared memory area. The kernel maintains and administers the shared memory areas and allows individual processes access to the shared area.

ipcs command prints report on interprocess communication (IPC) message queues, shared memory segments, and semaphore arrays for which the current process has read access. Options can be used to specify the type of resources to report on and the output format of the report. The ipcs command allows you to view the current shared memory pages on the system. Here’s the output from a sample ipcs command:

# ipcs -m
------ Shared Memory Segments --------
key        shmid     owner     perms     bytes     nattch    status
0x00000000 0         rich      600       52228     6         dest
0x395ec51c 1         oracle    640       5787648   6

Each shared memory segment has an owner that created the segment. Each segment also has a standard Linux permissions setting that sets the availability of the segment for other users. The key value is used to allow other users to gain access to the shared memory segment.

ipcs Command Examples

1. To see the shared memory segment:

# ipcs -m 

2. To see the message queue:

# ipcs -q 

3. To see the semaphore arrays:

# ipcs -s 

4. To see all:

# ipcs -a

5. To have the output format:

# ipcs
-t     time
-p     pid
-c     creator
-l     limits
-u     summary 
Related Post