工作中常用的Linux命令:ipcs/ipcrm命令

本文链接:http://www.cnblogs.com/MartinChentf/p/6057100.html (转载请注明出处)

ipcs

1. 命令格式

  ipcs [resource-option] [output-format]
  ipcs [resource-option] -i id

2. 命令功能

  提供IPC设备的信息

3. 使用方法

 resource选项:

  ipcs -m  查看系统共享内存信息

  ipcs -q  查看系统消息队列信息

  ipcs -s  查看系统信号量信息

  ipcs [-a] 系统默认输出信息,显示系统内所有的IPC信息

[martin@localhost data]$ ipcs -a

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 229376     martin     600        4194304    2          dest         
0x00000000 196609     martin     600        524288     2          dest         
0x00000000 327682     martin     600        393216     2          dest         
0x00000000 491525     martin     600        2097152    2          dest         

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     

 

 输出格式控制:

  ipcs -c  查看IPC的创建者和所有者

  ipcs -l  查看IPC资源的限制信息

  ipcs -p  查看IPC资源的创建者和使用的进程ID

  ipcs -t  查看最新调用IPC资源的详细时间

  ipcs -u  查看IPC资源状态汇总信息

[martin@localhost data]$ ipcs -u --human

------ Messages Status --------
allocated queues = 0
used headers = 0
used space = 0B

------ Shared Memory Status --------
segments allocated 4
pages allocated 1760
pages resident  339
pages swapped   0
Swap performance: 0 attempts     0 successes

------ Semaphore Status --------
used arrays = 0
allocated semaphores = 0

 

 额外格式控制:

  ipcs -l --human

    以人类可以阅读的方式显示size

[martin@localhost data]$ ipcs -l --human

------ Messages Limits --------
max queues system wide = 3644
max size of message = 8K
default max size of queue = 16K

------ Shared Memory Limits --------
max number of segments = 4096
max seg size = 16E
max total shared memory = 16E
min seg size = 1B

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 3276

 

ipcrm

1. 命令功能

  通过指定ID删除删除IPC资源,同时将与IPC对象关联的数据一并删除,只有超级用户或IPC资源创建者能够删除

2. 使用方法

  ipcrm -M shmkey

    移除用shmkey创建的共享内存段

  ipcrm -m shmid

    移除用shmid标识的共享内存段

  ipcrm -S semkey

    移除用semkey创建的信号量

  ipcrm -s semid

    移除用semid标识的信号量

  ipcrm -Q msgkey

    移除用msgkey创建的消息队列

  ipcrm -q msgid

    移除用msgid标识的消息队列

 

posted @ 2016-11-12 17:19  Chentf  阅读(12581)  评论(0编辑  收藏  举报