<\/span><\/h2>\nFirst, we are going to look at how we can find the largest directories and files in Linux combined, execute the following command to find the top 10 largest directories and files on your Linux server:<\/p>\n
# du -ah \/* 2>\/dev\/null | sort -rh | head -n 10<\/pre>\nThe output should show you the largest directories and files:<\/p>\n
3.2G \/backup\r\n1.3G \/usr\r\n1.1G \/var\r\n922M \/home\r\n713M \/var\/lib\r\n584M \/odoo\r\n580M \/usr\/lib\r\n579M \/odoo\/odoo-server\r\n501M \/home\/largefile3\r\n404M \/odoo\/odoo-server\/addons\r\n<\/pre>\n<\/span>Find\u00a0the top largest directories in Linux<\/span><\/h2>\nThis command can be pretty useful when you need to check the size of the directories in the root partition to get an idea of how the used space on your server is distributed. Using the following command you can find the top 10 largest directories in the root partition:<\/p>\n
# du -sh \/*\/ 2>\/dev\/null | sort -rh | head -n 10<\/pre>\nThe output should show you the largest directories:<\/p>\n
3.2G \/backup\r\n1.3G \/usr\/\r\n1.1G \/var\/\r\n922M \/home\/\r\n584M \/odoo\/\r\n135M \/opt\/\r\n43M \/lib\/\r\n40M \/run\/\r\n30M \/root\/\r\n10M \/bin\/\r\n<\/pre>\nYou can also use the following command to check the size of the sub-directories of a given directory, in this case, we’ll use the directory ‘var’:<\/p>\n
# find \/var\/* -type d -exec du -sh {} 2>\/dev\/null + | sort -rh | head -n 10<\/pre>\nThe output should list the sub-directories of the ‘var’ directory:<\/p>\n
713M \/var\/lib\r\n357M \/var\/cache\r\n40M \/var\/www\r\n3.1M \/var\/log\r\n124K \/var\/spool\r\n52K \/var\/backups\r\n20K \/var\/mail\r\n12K \/var\/tmp\r\n4.0K \/var\/opt\r\n4.0K \/var\/local\r\n<\/pre>\n