The “ipcrm” command is a command-line utility that is used to delete various types of IPC (Inter-process Communication) resources. These resources include shared memory, message queues, and semaphores.
It’s also important to note that “ipcrm” command is used to delete the IPC resources that were created using “ipcmk” command or similar IPC creation commands.
If you encounter the below error while running the command ipcrm:
ipcrm: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install util-linux |
Ubuntu | apt-get install util-linux |
Alpine | apk add util-linux |
Arch Linux | pacman -S util-linux |
Kali Linux | apt-get install util-linux |
CentOS | yum install util-linux |
Fedora | dnf install util-linux |
OS X | brew install util-linux |
Raspbian | apt-get install util-linux |
ipcrm Command Examples
1. Delete a shared memory segment by ID:
# ipcrm --shmem-id shmem_id
2. Delete a shared memory segment by key:
# ipcrm --shmem-key shmem_key
3. Delete an IPC queue by ID:
# ipcrm --queue-id ipc_queue_id
4. Delete an IPC queue by key:
# ipcrm --queue-key ipc_queue_key
5. Delete a semaphore by ID:
# ipcrm --semaphore-id semaphore_id
6. Delete a semaphore by key:
# ipcrm --semaphore-key semaphore_key
7. Delete all IPC resources:
# ipcrm --all