: Discover Excellence

The Path To Discover Excellence.

Thursday, 28 February 2019

‘IPCS’ command in Linux with examples

 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, the 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.

Options :

  • -q : Write information about active message queues.
  • -m : Write information about active shared memory segments.
  • -s : Write information about active semaphore sets.
  • -a : Use all print options. (This is a shorthand notation for -b, -c, -o, -p, and -t.)
  • -b : Write information on maximum allowable size. (Maximum number of bytes in messages on queue for message queues, size of segments for shared memory, and number of semaphores in each set for semaphores.)
  • -c : Write creator’s user name and group name;.
  • -o : Write information on outstanding usage. (Number of messages on queue and total number of bytes in messages on queue for message queues, and number of processes attached to shared memory segments.)
  • -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.)

Examples on IPCS command:

1: To list all the IPC facility

# ipcs -a : It provides details about message queue, semaphore and shared memory.

All the IPC facility has unique key and identifier, which is used to identify an IPC facility.

2: To list all the Message Queue

$ ipcs -q : It lists only message queues for which the current process has read access.

3. To list all the Semaphores

# ipcs -s : To list the accessible semaphores.

4. To list all the Shared Memory

# ipcs -m : To lists the shared memories.

5. To get the detailed information about an IPC facility

# ipcs -m -i 425984 : To detailed information about an ipc facility(here for id-425984).

6. To lists the Limits for IPC facility

# ipcs -m -l : To get the system limits for each ipc facility.

# ipcs -l : To get the limits for all three IPC facilities.

7. To list Creator and Owner Details for IPC Facility

# ipcs -m -c : To list creator userid and groupid and owner userid and group id.

8. To get the process ids that accessed IPC facility recently

# ipcs -m -p : To displays creator id, and process id which accessed the corresponding ipc facility very recently.

9. To get the last Accessed Time

# ipcs -s -t : To get the last operation time in each ipc facility.

10. To get the status of current usage

# ipcs -u : To display current usage for all the IPC facility.

No comments:

Post a comment