Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ipcrm - remove inter-process communication facilities

&pagelevel(4)&pagelevel

The command ipcrm can be used to remove one or more semaphores, message queues, shared memory or inter-process communication facilities (IPC facilities) from the system. These can be specified either by their identifiers or by the key with which each such IPC facility was created.

The identifiers and keys of IPC facilities can be listed with the help of the ipcs command (ID and KEY output columns). For more information on how a message queue, shared memory or semaphore is removed, refer to the msgctl(), shmctl() and semctl() functions in the manual "C Library Functions for POSIX Applications" [4].


Syntax


ipcrm[ option]...

option

-q msgqid

(queue)

Removes the message queue identified as msgqid from the system and destroys the data structures associated with it.

msgqid

Identifier of the message queue to be removed.
This identifier is displayed by the ipcs command in the ID column.

-Q msgkey

(queue)

Removes the message queue identifier msgkey from the system and destroys the data structures associated with it.

msgkey

Key of the message queue to be removed.
This key is displayed by the ipcs command in the KEY column.

-m shmid

(memory)

Removes the shared memory identified as shmid from the system and destroys the data structures associated with it.

shmid

Identifier of the shared semaphore set to be removed.
This identifier is displayed by the ipcs command in the ID column.

-M shmkey

(memory)

Removes the shared memory identified as shmkey from the system and destroys the data structures associated with it.

shmkey

Key with which the shared memory to be removed was created.
This key is displayed by the ipcs command in the KEY column.

-s semid

(semaphore)

Removes the semaphore set identified as semid from the system and destroys the data structures associated with it.

semid

Identifier of the semaphore set to be removed.
This identifier is displayed by the ipcs command in the ID column.

-S semkey

(semaphore)

Removes the semaphore set identified as semkey from the system and destroys the data structures associated with it.

semkey

Key with which the semaphore set to be removed was created.
This key is displayed by the ipcs command in the KEY column.

Example

Use ipcs to first print a report on the status of the inter-process communication facilities and then remove the message queue with the identifier 40 from the system:

$ ipcs

IPC status from /dev/kmem as of Mon Mar 1 09:23:29 2021

T     ID        KEY        MODE    OWNER    GROUP

Message Queues:

q     40 0x0000004b -Rrw-rw-rw-    user1 usrother

Shared Memory:

Semaphores:

$ ipcrm -q 40

See also

ipcs
msgctl(), msgget(), semctl(), semget(), semop(), shmctl(), shmget() [4]