Skip to main content

Posts

Showing posts from June, 2013

Checking SWAP on RHEL

the quickest/simplest method seems to be run top then press "O p" Otherwise I have found some scripts out there to do similar reporting. DISCLAIMER: I did not write this script, nor do I endorse it.  There is a TON of new file creation and overwrite and then removal of files.  So - test this on a host that is not that important, or as a non-root user. #!/bin/bash # find-out-what-is-using-your-swap.sh # -- Get current swap usage for all running processes # -- # -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting # -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output # -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version SCRIPT_NAME=`basename $0`; SORT="kb"; # {pid|kB|name} as first parameter, [default: kb] [ "$1" != "" ] && { SORT="$1"; } [ ! -x `which mktemp` ] && { echo "ERROR: m

BASH profile setup

#******************************************************************************** # .bashrc #******************************************************************************** # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions function set_title {   title=$1;   echo -e "\033];${title}\007"; } # replaced the following by using ~/.ssh/config #alias ssh="ssh -o TCPKeepAlive=yes -o ServerAliveInterval=50 -XCA ${1}" alias vms="sudo virsh list --inactive --all" alias vv="sudo virt-viewer ${1}" alias doover='/usr/bin/sudo $(history -p \!\!)' alias please='/usr/bin/sudo $(history -p !!)' alias itunes='/usr/bin/vncviewer --CompressLevel=6 cypher.matrix.private' #******************************************************************************** # .bash_profile #****************************************************************************

Check my disk space usage

A database system is reporting it is out of disk... After cleaning up an 8GB root mail file and a few other users... things are OK... but the Free Space is disappearing! I found a snippet of shell foo that I thought was useful (site listed below) hdparm -tT /dev/sda Unix and Linux System Administ (Google Affiliate Ad) Building Embedded Linux System (Google Affiliate Ad) sort by size: sudo lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 50   process with most files open: sudo lsof | awk '$5 == "REG" {freq[$2]++ ; names[$2] = $1 ;} END {for (pid in freq) print freq[pid], names[pid], pid ; }' | sort -n -r -k 1,1  References: http://thegoogleof.blogspot.com/2011/11/lsof-sort.html http://www.ibm.com/developerworks/aix/library/au-lsof.html