{
    "mode": "man",
    "parameter": "IPCRM",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/IPCRM/1/json",
    "generated": "2026-10-21T17:11:05Z",
    "synopsis": "ipcrm [options]\nipcrm [shm|msg|sem] ID ...",
    "sections": {
        "NAME": {
            "content": "ipcrm - remove certain IPC resources\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ipcrm [options]\n\nipcrm [shm|msg|sem] ID ...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ipcrm removes System V inter-process communication (IPC) objects and associated data\nstructures from the system. In order to delete such objects, you must be superuser, or the\ncreator or owner of the object.\n\nSystem V IPC objects are of three types: shared memory, message queues, and semaphores.\nDeletion of a message queue or semaphore object is immediate (regardless of whether any\nprocess still holds an IPC identifier for the object). A shared memory object is only removed\nafter all currently attached processes have detached (shmdt(2)) the object from their virtual\naddress space.\n\nTwo syntax styles are supported. The old Linux historical syntax specifies a three-letter\nkeyword indicating which class of object is to be deleted, followed by one or more IPC\nidentifiers for objects of this type.\n\nThe SUS-compliant syntax allows the specification of zero or more objects of all three types\nin a single command line, with objects specified either by key or by identifier (see below).\nBoth keys and identifiers may be specified in decimal, hexadecimal (specified with an initial\n'0x' or '0X'), or octal (specified with an initial '0').\n\nThe details of the removes are described in shmctl(2), msgctl(2), and semctl(2). The\nidentifiers and keys can be found by using ipcs(1).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-a --all",
                    "content": "Remove all resources. When an option argument is provided, the removal is performed only\nfor the specified resource types.\n\nWarning! Do not use -a if you are unsure how the software using the resources might react\nto missing objects. Some programs create these resources at startup and may not have any\ncode to deal with an unexpected disappearance.\n",
                    "flag": "-a",
                    "long": "--all"
                },
                {
                    "name": "-M --shmem-key _",
                    "content": "Remove the shared memory segment created with shmkey after the last detach is performed.\n",
                    "flag": "-M",
                    "long": "--shmem-key"
                },
                {
                    "name": "-m --shmem-id _",
                    "content": "Remove the shared memory segment identified by shmid after the last detach is performed.\n",
                    "flag": "-m",
                    "long": "--shmem-id"
                },
                {
                    "name": "-Q --queue-key _",
                    "content": "Remove the message queue created with msgkey.\n",
                    "flag": "-Q",
                    "long": "--queue-key"
                },
                {
                    "name": "-q --queue-id _",
                    "content": "Remove the message queue identified by msgid.\n",
                    "flag": "-q",
                    "long": "--queue-id"
                },
                {
                    "name": "-S --semaphore-key _",
                    "content": "Remove the semaphore created with semkey.\n",
                    "flag": "-S",
                    "long": "--semaphore-key"
                },
                {
                    "name": "-s --semaphore-id _",
                    "content": "Remove the semaphore identified by semid.\n",
                    "flag": "-s",
                    "long": "--semaphore-id"
                },
                {
                    "name": "-h --help",
                    "content": "Display help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-V --version",
                    "content": "Print version and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "NOTES": {
            "content": "In its first Linux implementation, ipcrm used the deprecated syntax shown in the second line\nof the SYNOPSIS. Functionality present in other *nix implementations of ipcrm has since been\nadded, namely the ability to delete resources by key (not just identifier), and to respect\nthe same command-line syntax. For backward compatibility the previous syntax is still\nsupported.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ipcmk(1), ipcs(1), msgctl(2), msgget(2), semctl(2), semget(2), shmctl(2), shmdt(2),\nshmget(2), ftok(3), sysvipc(7)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The ipcrm command is part of the util-linux package which can be downloaded from Linux Kernel\nArchive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\nutil-linux 2.39.3                            2023-10-23                                     IPCRM(1)",
            "subsections": []
        }
    },
    "summary": "ipcrm - remove certain IPC resources",
    "flags": [
        {
            "flag": "-a",
            "long": "--all",
            "arg": null,
            "description": "Remove all resources. When an option argument is provided, the removal is performed only for the specified resource types. Warning! Do not use -a if you are unsure how the software using the resources might react to missing objects. Some programs create these resources at startup and may not have any code to deal with an unexpected disappearance."
        },
        {
            "flag": "-M",
            "long": "--shmem-key",
            "arg": null,
            "description": "Remove the shared memory segment created with shmkey after the last detach is performed."
        },
        {
            "flag": "-m",
            "long": "--shmem-id",
            "arg": null,
            "description": "Remove the shared memory segment identified by shmid after the last detach is performed."
        },
        {
            "flag": "-Q",
            "long": "--queue-key",
            "arg": null,
            "description": "Remove the message queue created with msgkey."
        },
        {
            "flag": "-q",
            "long": "--queue-id",
            "arg": null,
            "description": "Remove the message queue identified by msgid."
        },
        {
            "flag": "-S",
            "long": "--semaphore-key",
            "arg": null,
            "description": "Remove the semaphore created with semkey."
        },
        {
            "flag": "-s",
            "long": "--semaphore-id",
            "arg": null,
            "description": "Remove the semaphore identified by semid."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help text and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print version and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "ipcmk",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ipcmk/1/json"
        },
        {
            "name": "ipcs",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ipcs/1/json"
        },
        {
            "name": "msgctl",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/msgctl/2/json"
        },
        {
            "name": "msgget",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/msgget/2/json"
        },
        {
            "name": "semctl",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/semctl/2/json"
        },
        {
            "name": "semget",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/semget/2/json"
        },
        {
            "name": "shmctl",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/shmctl/2/json"
        },
        {
            "name": "shmdt",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/shmdt/2/json"
        },
        {
            "name": "shmget",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/shmget/2/json"
        },
        {
            "name": "ftok",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/ftok/3/json"
        },
        {
            "name": "sysvipc",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/sysvipc/7/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Delete IPC (Inter-process Communication) resources.",
        "examples": [
            {
                "description": "Delete a shared memory segment by ID",
                "command": "ipcrm {{-m|--shmem-id}} {{shmem_id}}"
            },
            {
                "description": "Delete a shared memory segment by key",
                "command": "ipcrm {{-M|--shmem-key}} {{shmem_key}}"
            },
            {
                "description": "Delete an IPC queue by ID",
                "command": "ipcrm {{-q|--queue-id}} {{ipc_queue_id}}"
            },
            {
                "description": "Delete an IPC queue by key",
                "command": "ipcrm {{-Q|--queue-key}} {{ipc_queue_key}}"
            },
            {
                "description": "Delete a semaphore by ID",
                "command": "ipcrm {{-s|--semaphore-id}} {{semaphore_id}}"
            },
            {
                "description": "Delete a semaphore by key",
                "command": "ipcrm {{-S|--semaphore-key}} {{semaphore_key}}"
            },
            {
                "description": "Delete all IPC resources",
                "command": "ipcrm {{-a|--all}}"
            }
        ]
    }
}