Condensed version of this post by Brendan Gregg @ Netflix uptime – load averages dmesg -T | tail – kernel errors vmstat 1 – overall stats by time mpstat -P ALL 1 – cpu balance pidstat 1 – process usage iostat -xz 1 – disk i/o free -m – memory usage sar -n DEV 1…
Author: admin
Finding a string in many files on linux
In a directory find . -name “*ABC*” -exec grep -H ‘XYZ’ {} + This essentially uses find to find the file, then -exec grep will search IN all the matching files for the string you specified.
‘splain
This entire post was written by Mark Driver, formerly of blindwino.com and all copyrights I assume belong to him. The site and article has been offline for a while but I found it so insightful I saved it. It appears that Mark currently keeps a blog or site @ https://blindwino.wordpress.com/ He can be found on…
Example file reaper cron
10 1 * * * /usr/bin/find /usr/local/stuff -maxdepth 1 -mtime +30 -type d | /usr/bin/xargs -r rm -r
Quick postfix queue depth script
Or counting files in any folder(s) for i in `ls -al /var/spool/postfix |grep ‘^d’|awk ‘{print $9}’|grep -v ‘\.$’`; do c=`find $i|wc -l`; echo “$c $i”; done;
Gary calls in sick…
Gary: here’s a great trick for calling in sick. jami – pretend that you’re not listening. nobody copy and paste to HR. Call your boss while lying on your back with your neck hanging over the bed. Peter: Good advice. I always just tried to sound congested, but that sounds more grounded in science. Gary:…
FreeIPA Server/Client setup on CentOS 6.5
So I’ve been dorking around with 389-ds a LOT at work lately and it’s a bitch to setup, especially when it comes to the certs. As a hackathon project I decided to setup FreeIPA, which is the Free version of Redhat Identity Manager as a more comprehensive and easy to manage solution. I have this…
Yum and kernels, removing old one’s and limiting how many kernels yum keeps around
Check installed kernels: # rpm -q kernel kernel-2.6.32-279.el6.x86_64 kernel-2.6.32-279.2.1.el6.x86_64 kernel-2.6.32-279.5.2.el6.x86_64 kernel-2.6.32-279.9.1.el6.x86_64 Remove old kernels: # package-cleanup –oldkernels –count=2 Make it permanent: #vi etc/yum.conf installonly_limit=2
Working with volume groups that have the same name (cloned disk, recoveries, etc)
First, we attach the vmdk to the vm and then scan the bus to see it in linux: # echo “- – -” > /sys/class/scsi_host/host0/scan In this scenario, /dev/sda2 and /dev/sdb2 have the same volume group name of VolGroup00, let’s rename /dev/sdb2 to VolGroup01: # vgimportclone –basevgname VolGroup01 /dev/sdb2 next let’s find the new VolumeGroup:…
Finding biggest directories in linux
find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}