Linux: Find the largest files and directories

This command will list top 10 files and directories by size.

find / -printf '%s %p\n'| sort -nr | head -10

To find just the large files and skip the directories, run the following command

find / -type f -printf '%s %p\n'| sort -nr | head -10

 To fine the large files of a certain type, run the following command

find / -type f -iname "*.gz" -printf '%s %p\n'| sort -nr | head -10

An alternate way of finding out the biggest files and folders is:

du -a / | sort -n -r | head -n 10

Installing Tomcat 6 on Fedora, Red Hat or CentOS

Install Tomcat using yum

# yum install tomcat6-webapps

Tomcat will get installed across the following directories

/etc/tomcat6             conf files     $CATALINA_HOME/conf
/usr/share/java/tomcat6  libs           $CATALINA_HOME/lib
/usr/share/tomcat6/bin   executables    $CATALINA_HOME/bin
/var/log/tomcat6         logs           $CATALINA_HOME/logs
/var/cache/tomcat6/temp  temp files     $CATALINA_HOME/temp
/usr/share/tomcat6       home directory $CATALINA_HOME
/var/lib/tomcat6/webapps web apps       $CATALINA_HOME/webapps
/var/cache/tomcat6/work  compiled stuff $CATALINA_HOME/work

Set CATALINA_HOME in /etc/profile

export CATALINA_HOME=/usr/share/tomcat6

Tomcat can be stopped, started and restarted using the following commands

# service tomcat6 stop
# service tomcat6 start
# service tomcat6 restart