LinuxCommandLibrary

ipcrm

TLDR

Delete shared memory segment by ID

$ ipcrm -m [shmem_id]
copy
Delete shared memory segment by key
$ ipcrm -M [shmem_key]
copy
Delete message queue by ID
$ ipcrm -q [queue_id]
copy
Delete message queue by key
$ ipcrm -Q [queue_key]
copy
Delete semaphore by ID
$ ipcrm -s [semaphore_id]
copy
Delete semaphore by key
$ ipcrm -S [semaphore_key]
copy
Delete all IPC resources
$ ipcrm -a
copy

SYNOPSIS

ipcrm [options]

DESCRIPTION

ipcrm removes System V IPC resources (shared memory segments, message queues, and semaphores). Resources can be identified by either their numeric ID or key value.
Use ipcs to list existing resources and their IDs/keys before removal. Resources should be removed when no longer needed to free system resources.

PARAMETERS

-m, --shmem-id ID

Remove shared memory segment by ID
-M, --shmem-key KEY
Remove shared memory segment by key
-q, --queue-id ID
Remove message queue by ID
-Q, --queue-key KEY
Remove message queue by key
-s, --semaphore-id ID
Remove semaphore set by ID
-S, --semaphore-key KEY
Remove semaphore set by key
-a, --all
Remove all IPC resources

CAVEATS

Removing resources while processes are still using them can cause those processes to fail. Requires appropriate permissions (owner or root). The -a option removes all accessible resources.

HISTORY

ipcrm has been part of Unix systems since System V IPC was introduced in the early 1980s. It provides essential cleanup functionality for IPC resources that persist beyond process lifetime.

SEE ALSO

ipcs(1), ipcmk(1), lsipc(1)

Copied to clipboard