
ipcs Command in Linux
The ipcs command in Linux displays information about Inter-Process Communication (IPC) facilities. IPC facilities enable processes to communicate, synchronize, and share system resources. These mechanisms facilitate data exchange and coordination between independent processes running on the same or different systems, making them essential for multi-tasking in Linux.
By default, the ipcs command shows information about all three resources: shared memory segments, message queues, and semaphore arrays.
Table of Contents
Here is a comprehensive guide to the options available with the ipcs command −
Syntax of ipcs Command
The syntax of the Linux ipcs command is as follows −
ipcs [options]
The [options] field is used to specify various options to display information about different IPC facilities.
ipcs Command Options
The general options of the ipcs command are listed below −
Flags | Options | Description |
---|---|---|
-i id | --id=id | Show full details of a specific resource by ID (it requires -m, -q and -s) |
-h | --help | To display help related to command |
-V | --version | To display the command version |
The resource options display information about specific resources, such as shared memory, message queues, and semaphores. The resource options are listed below −
Flags | Options | Description |
---|---|---|
-m | --shmems | To display information about active shared memory segments |
-q | --queues | To display information about active message queues |
-s | --semaphores | To display information about active semaphore sets |
-a | --all | To display information about all three resources (default) |
The ipcs command output can be formatted using format options. A list of ipcs format options is given below −
Flags | Options | Description |
---|---|---|
-c | --creator | To display the creator and owner |
-l | --limits | To display resource limit |
-p | --pid | To show PIDs of the creator and last operator |
-t | --time | To display time information for IPC resources |
-u | --summary | To display the status summary |
-b | --bytes | To show sizes in bytes instead of human-readable format (used with -l or --limits) |
--human | To display information in human-readable format (used with -l or --limits) |
Examples of ipcs Command in Linux
This section demonstrates the usage of the ipcs command in Linux with examples −
Displaying All IPC Resources
To display information about all IPC resources, use the -a or --all option with the ipcs command −
ipcs -a

The output image shows resource information of shared memory segments, message queues, and semaphore sets.
Displaying Shared Memory Segments
To display information about shared memory segments in use, use the -m or --shmems option −
ipcs -m

In the output image, shmid represents the shared memory ID, owner is the user who owns the segment, and bytes indicate the memory size.
This is useful when diagnosing memory-related issues in applications that use shared memory for communication.
Displaying Message Queues
To display information about message queues, use the -q or --queues option −
ipcs -q

Displaying Semaphore Sets
To display information about semaphore sets, use the -s or --semaphores option −
ipcs -s

Displaying System IPC Limits
To display the system limits related to IPC resources, use the -l or --limits option −
ipcs -l

The output shows information like the maximum number of message queues, maximum size of shared memory segments, and the number of semaphores allowed on the system. This is particularly useful for checking if your system has hit any limits on the number or size of IPC objects.
Displaying Information of Specific IPC Resource
To display the information of a specific IPC resource, use the -i or --id option with the resource ID. For example, to get details about a shared memory segment with ID 0, use the ipcs command in the following way −
ipcs -m -i 0

Note that the -i or --id option will always be used with -m, -q, or -s options.
Displaying Creator and Owner Information
To display creator and owner information, use the -c or --creator option −
ipcs -c

Displaying PIDs of Creator and Last Operator
To display PIDs of the creator and last operator, use the -p or --pid option −
ipcs -p

Displaying Time Information
To display the time information, use the -t or --time option −
ipcs -t

This command displays the last access and modification times for each IPC object.
Displaying Summary of IPC Resource Usage
To display a summary of IPC resource usage, use the -u or --summary option with the ipcs command −
ipcs -u

Displaying IPC Resources in Human Readable format
Use the --human option to display the IPC resources in a human-readable format. For example, to display the resource limit in human-readable format, use the command given below −
ipcs -l --human

Displaying IPC Resources in Bytes
Use the -b or --bytes option to display the IPC resources in bytes. To display the resource limit in bytes, use the command given below −
ipcs -l -b

Displaying Help
Use the -h or --help option to display a brief help message related to the command −
ipcs -h
Conclusion
The ipcs command in Linux is used for inspecting Inter-Process Communication (IPC) facilities, which are crucial for enabling communication and synchronization between processes. By offering options to display details about shared memory, message queues, and semaphore sets, the command helps monitor and manage system resources effectively. It also allows users to customize the output format to include information such as resource limits, creator details, and timestamps.
This tutorial explained the ipcs command, its syntax, options, and usage in Linux with examples.