for i in *; do echo -n "$i: "; find $i -type f | wc -l; done
Showing posts with label System Administration. Show all posts
Showing posts with label System Administration. Show all posts
Tuesday, April 23, 2013
Show Recursive Count Total Number Of Files In Folders
Friday, March 8, 2013
Kill All Specific Processes Returned From Process List
Let's say you want to kill many specific processes from the output of PS
kill -9 $(ps aux | grep process_to_kill | awk '{print $2}')
This is handy when there isn't a fixed process/application handle that works with "killall -9"
Wednesday, January 16, 2013
Detect Orphaned MySQL Databases On Linux Running cPanel
This script relies on databases being in the following format:
username_database-name
...and located in:
/var/lib/mysql
username_database-name
...and located in:
/var/lib/mysql
cd /var/lib/mysql
for I in `ls -d */ | grep '_' | cut -d '_' -f 1 | uniq`
do
if [ ! -d "/home/$I" ]; then
echo User $I doesnt exist - databases to be cleaned up!
fi
done
This should be used with caution and user existence manually verified but will give you a starting point.
Subscribe to:
Posts (Atom)