Run ipcs-m to view the current shared memory usage. The sections are described as follows:
View shared memory segments
Run ipcs-m to view the current shared memory usage. Each part is explained as follows:
Key: The unique key value of the shared memory. the shared memory uses this key to determine which memory you are reading.
Shmid: when the key is used to obtain the memory, you get the value of this id. It is the identifier of the memory block you operate on.
Owner: The user who creates the shared memory block
Perms: the read and write permissions of the shared memory, which is forbidden by 8, can be 777, consistent with the read and write permissions of the file.
Bytes: size of the memory block
Nattch: number of processes connected to the memory block
Status: The current status, for example, dest, to be deleted.
Operation shared memory segments
Ipcrm can be used to delete the corresponding shared memory segments, semaphores, and message queues;
Command example:
Ipcrm-s semid deletes the corresponding semaphore set
Ipcrm-m shmid deletes the corresponding shared memory segment
Ipcrm-q msqid: delete the corresponding message queue
Ipcrm can only delete a single resource. you can use the following command to delete multiple resources in batches (zhangsj is copyrighted ):
1. ipcs-s | grep user name | cut-d ""-f2 | xargs-n1 ipcrm-s
2. ipcs-s | awk '/user name/{print $2}' | xargs-n1 ipcrm-s
3. ipcs-s | awk '/user name/{system ("ipcrm-s" $2 )}'
4. for I in echo 'ipcs | grep username | cut-d ""-f2'; do ipcrm-s $ I; done
This article reprinted from The http://2813385.blog.51cto.com/2803385/537415 | http://blog.csdn.net/zombee/article/details/6678787 hereby thank you!