Tech Support Notes

Random Bash commands

Deleted files have not freed up space? Use this to kill of the PIDs and restore space

for x in $(lsof /path|egrep 'deleted'|awk '{print $2}'); do kill -9 $x;done

Highlight text. Usage: cat file|highlight term

highlight() { perl -pe "s/$1/\e[1;31;43m$&\e[0m/g"; }
You can use this in conjunction with cat, less, more, head and tail
tail -f /var/log/messages|highlight ftpd

Check for all immutable files

lsattr 2>/dev/null | while red X Y; do if [ $(echo $X | cut -b 5) == "i" ]; then echo $X $Y; fi ; done

Add specified modules to the php.ini file

PHP_MODULES=(gd iconv imap mcrypt mysqli mysql openssl pdo_mysql posix soap xmlrpc zip)
for phpModule in ${PHP_MODULES[@]}; do perl -pi -e 's/^;extension='${phpModule}'.so/extension='${phpModule}'.so/g' /path/to/php.ini
done

To Sort/Test

utmpdump /var/log/wtmp

rpm -qa |grep ^perl |wc -l

ps awfux | awk '/ph[p]/{print $1}' | sort | uniq -c | sort -nk1

exec ls /home/ | sed 's/\([0-9]\+\).*/\1/g' | sort -n | tail -10 

cat /proc/cpuinfo | egrep '(model\name|processor|phy)'| grep -v bits| sort| grep -v processor | uniq -c

zgrep IP /var/log/messages* | grep "is now logged in"

less /var/log/messages | egrep 'SRC=' | awk '{print $12}' | cut -d = -f2 | sort -n | uniq -c | sort -n

xfreerdp --plugin cliprdr --composition --ignore-certificate --rfx --rfx-mode i -g 1152x864 -u administrator  -p $2 $1

ps weauxf | egrep -i '/home/*/public_html/wp-login.php' | wc -l

df -T | awk '{print $1,$2,$NF}' | grep "^/dev"