Bootstrap FreeKB - Linux Commands - ipcs (list semaphores)
Linux Commands - ipcs (list semaphores)

Updated:   |  Linux Commands articles

The ipcs command with the -s or --semaphores flag can be used to display the semaphores currently in used. Notice the output includes semid (semaphore ID).

[root@server1 ~]# ipcs --semaphores

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x00000000 131073     nobody     600        1         
0x00000000 196610     nobody     600        1         
0x00000000 131076     nobody     600        1         
0x00000000 5          nobody     600        1         
0x00000000 131078     nobody     600        1         
0x00000000 7          nobody     600        1

 

The ipcs command with the -s or --semaphores flag and -i or --id option can be used to get the details of a semaphore, including the process ID (PID) associated with the semaphore. In this example, semaphore ID 131073 is associated with PID 129086.

[root@server1 ~]# ipcs -s -i 131073

Semaphore Array semid=131073
uid=99   gid=99  cuid=0  cgid=0
mode=0600, access_perms=0600
nsems = 1
otime = Tue Aug  3 00:00:12 2021  
ctime = Mon Aug  2 23:56:16 2021  
semnum     value      ncount     zcount     pid       
0          1          0          0          129086

 

The ps command can be used to display details on the process. 

[root@server1 ~]# ps -ef | grep 129086
nobody   129086 126409  0 00:00 ?        00:00:00 /opt/IBMIHS/bin/httpd -d /opt/IBMIHS -f /opt/IBMIHS90/conf/httpd90.conf -k start

 

The ipcrm command with the -s or --semaphore-id option can be used to remove semaphores.

[root@server1 ~]# ipcrm -s 131073

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f1f6f2 in the box below so that we can be sure you are a human.