<input type="hidden" id="_wpnonce" name="_wpnonce" value="287a36aecf" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/3935" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="287a36aecf" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/3935" />{"id":3935,"date":"2015-10-30T16:09:13","date_gmt":"2015-10-30T05:09:13","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=3935"},"modified":"2015-10-30T16:09:13","modified_gmt":"2015-10-30T05:09:13","slug":"how-to-find-the-largest-files-or-directories-on-your-vps","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2015\/10\/30\/how-to-find-the-largest-files-or-directories-on-your-vps\/","title":{"rendered":"HOW TO FIND THE LARGEST FILES OR DIRECTORIES ON YOUR VPS"},"content":{"rendered":"<!--CusAds0--><p>My CentOS VPS was running out of space so I needed to do a bit of a clean up and decided to see which files and directories used up the most space. So after some digging around I found these two commands.<\/p>\n<p>This one is to find the largest 10 <strong>directories<\/strong>:<\/p>\n<pre>find . -type d -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}<\/pre>\n<p><a href=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all&w=2560\"><img decoding=\"async\" class=\"alignnone size-full wp-image-3939\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all\" alt=\"Business Legions Find Largest Directories\" width=\"641\" height=\"284\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all 641w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories-300x133.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories-178x79.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all&amp;w=128 128w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all&amp;w=384 384w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all&amp;w=512 512w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Directories.png?strip=all&amp;w=450 450w\" sizes=\"(max-width: 641px) 100vw, 641px\" \/><\/a><\/p>\n<p>This one is to find the largest 10 <strong>files<\/strong>:<\/p><!--CusAds0-->\n<pre>find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-3938\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all\" alt=\"Business Legions Find Largest Files\" width=\"635\" height=\"191\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all 635w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files-300x90.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files-178x54.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all&amp;w=127 127w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all&amp;w=381 381w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all&amp;w=508 508w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2015\/10\/Business-Legions-Find-Largest-Files.png?strip=all&amp;w=450 450w\" sizes=\"(max-width: 635px) 100vw, 635px\" \/><\/p>\n<p>If you want to display more than 10 results then change the tail -10 to another amount. I then found a couple of large xml files and deleted these which freed up over 2 GB of data.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>My CentOS VPS was running out of space so I needed to do a bit of a clean up and decided to see which files and directories used up the most space. So after some digging around I found these two commands. This one is to find the largest 10 directories: find . -type d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3941,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[830,3],"tags":[1836,1734,1866,1973,1935,1974,1721,303],"class_list":["post-3935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-technology","category-technology","tag-centos","tag-cleanup","tag-directory","tag-files","tag-free","tag-large","tag-remove","tag-vps"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/3935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=3935"}],"version-history":[{"count":3,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/3935\/revisions"}],"predecessor-version":[{"id":3940,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/3935\/revisions\/3940"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/3941"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=3935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=3935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=3935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}