Never the Lost

Adventures of the Word at large…For Great Justice!

Code and Quick Scripts

Some very useful examples of code that will help you in your endevors….

Remove Semaphore Arrays that no longer have home.

ipcs -s|grep nobody|awk '{print $2}'|xargs ipcrm sem

This will show all IPs currently connected to port 80. You can change the :80 to any port you want to monitor. So, this isn’t just applicable to apache.

netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -f1 -d: | \sort | uniq -c | sort -rn | head

Oh Noz! My / partition is full! Gosh darn those pesky old kernels.

rpm -qa | grep kernel

So mytop presents you with: Error in option spec:”long|!” here is an easy fix.

replace ‘long|!’ ‘long!’ — /usr/bin/mytop

Handy way to quickly tune the file system to “hopefully” avoid a disk check on reboot.

for i in $(fdisk -l|grep Linux|grep dev|awk {‘print $1′}); do tune2fs -C 0 -T now $i;done

Leave a Reply