How can I delete all not used semaphores and shared memory with a single command on a UNIX-like system, e.g., Ubuntu?
ipcs -s | grep $USERNAME | perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
or
ipcs -s | grep $USERNAME | awk ' { print $2 } ' | xargs ipcrm sem
Change $USERNAME to a real username.