{"id":3225,"date":"2023-04-12T15:19:54","date_gmt":"2023-04-12T12:19:54","guid":{"rendered":"https:\/\/www.virtono.com\/community\/?p=3225"},"modified":"2023-04-07T15:32:44","modified_gmt":"2023-04-07T12:32:44","slug":"how-to-find-the-largest-files-in-linux","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-find-the-largest-files-in-linux\/","title":{"rendered":"How to find the largest files in Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When you have a server with 1TB of disk space and your storage is 80% full, it is important to find out which files(largest files) are taking up the most space on your system. This can be done by identifying the biggest files on your system and deleting or moving them to free up some space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To find the largest files on your system, you can use a command line tool such as &#8220;du&#8221; (short for disk usage). The &#8220;du&#8221; command shows the size of each file and directory in the current directory and its subdirectories. By using some options with the &#8220;du&#8221; command, you can sort the output to show the largest files at the top.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-find-the-largest-files-in-linux\/#Find_the_largest_files_in_Linux\" title=\"Find the largest files in Linux\">Find the largest files in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-find-the-largest-files-in-linux\/#Find_the_largest_files_in_Linux_using_find\" title=\"Find the largest files in Linux using find\">Find the largest files in Linux using find<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading has-header-gradient-color has-text-color\"><span class=\"ez-toc-section\" id=\"Find_the_largest_files_in_Linux\"><\/span>Find the largest files in <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-change-ssh-port-on-linux-or-unix\/\">Linux<\/a><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example command that you can use to find the biggest files on your system:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>du -ah \/ | sort -rh | head -n 20<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"497\" data-attachment-id=\"3226\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-find-the-largest-files-in-linux\/attachment\/screenshot-2023-04-07-at-15-06-13\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?fit=773%2C512&amp;ssl=1\" data-orig-size=\"773,512\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-04-07-at-15.06.13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?fit=750%2C497&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?resize=750%2C497&#038;ssl=1\" alt=\"How to find the largest files in Linux\" class=\"wp-image-3226\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?w=773&amp;ssl=1 773w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?resize=300%2C199&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.06.13.png?resize=768%2C509&amp;ssl=1 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This command will show the 20 biggest files on your system, sorted by size. The &#8220;du -ah \/&#8221; part of the command tells &#8220;du&#8221; to show the size of all files and directories starting from the root directory (&#8220;\/&#8221;). The &#8220;sort -rh&#8221; part of the command sorts the output in reverse numerical order, so the largest files appear at the top. Finally, the &#8220;head -n 20&#8221; part of the command limits the output to the 20 largest files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have identified the biggest files on your system, you can decide what to do with them. If you no longer need the files, you can delete them to free up some space. If the files are important but not frequently used, you can move them to an external hard drive or cloud storage to free up space on your server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s a good idea to periodically check for large files on your system and delete or move them as necessary to avoid running out of disk space.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-header-gradient-color has-text-color\"><span class=\"ez-toc-section\" id=\"Find_the_largest_files_in_Linux_using_find\"><\/span>Find the largest files in Linux using find<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example command using the &#8220;find&#8221; command to find the largest files on a Linux system:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>find $HOME -type f -printf '%s %p\\n' | sort -nr | head -10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Please take <strong>note<\/strong> that you can either use &#8220;\/&#8221; to search the entire system or replace &#8220;$HOME&#8221; with the directory you have selected.<\/em><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"337\" data-attachment-id=\"3227\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-find-the-largest-files-in-linux\/attachment\/screenshot-2023-04-07-at-15-16-36\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.16.36.png?fit=675%2C337&amp;ssl=1\" data-orig-size=\"675,337\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-04-07-at-15.16.36\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.16.36.png?fit=675%2C337&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.16.36.png?resize=675%2C337&#038;ssl=1\" alt=\"How to find the largest files in Linux\" class=\"wp-image-3227\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.16.36.png?w=675&amp;ssl=1 675w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-07-at-15.16.36.png?resize=300%2C150&amp;ssl=1 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>When you have a server with 1TB of disk space and your storage is 80% full, it is important to find out which files(largest files) are taking up the most space on your system. This can be done by identifying the biggest files on your system and deleting or moving<\/p>\n","protected":false},"author":8,"featured_media":3229,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3],"tags":[267,268],"class_list":["post-3225","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial-how-to","tag-find-the-largest-files","tag-linux-largest-files"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-find-largest-files-linux.png?fit=600%2C330&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-Q1","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3875,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/linux-how-to-search-text-in-a-pdf-file-via-command-line\/","url_meta":{"origin":3225,"position":0},"title":"Linux: How to search text in a PDF file via Command Line","author":"George B.","date":"September 15, 2023","format":false,"excerpt":"In this tutorial, we will explain how to search text in a PDF file using Linux command-line options. One of Linux's many advantages is its command-line interface (CLI), which allows users to complete difficult tasks using short, text-based commands. Linux Basics It's essential to understand what a PDF file is\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/09\/How-to-search-text-in-a-PDF-file-via-Command-Line.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1795,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/10-linux-basic-commands-every-user-should-know\/","url_meta":{"origin":3225,"position":1},"title":"10 Linux Basic Commands Every User Should Know","author":"Shreyash Sharma","date":"July 31, 2020","format":false,"excerpt":"Linux can be daunting to some, especially if you have seen people working only through the terminal. Trust me, its not as complicated as it seems neither is it that hard to learn. The only issue is manufacturers do not Linux with their systems. What is Linux? The entire family\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/7rQQixjPnrQv.png?fit=640%2C363&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/7rQQixjPnrQv.png?fit=640%2C363&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/7rQQixjPnrQv.png?fit=640%2C363&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":881,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/linux-security-privacy-on-linuxencryption\/","url_meta":{"origin":3225,"position":2},"title":"Linux Security: Privacy on Linux(Encryption)","author":"Daniel Draga","date":"January 26, 2017","format":false,"excerpt":"Security is an important but complex topic. So I'll be doing a series of articles, focusing on the principles and working of security of Linux. The challenge is that it\u2019s an ever-changing idea. Software we think of as secure can become insecure as hackers figure out how to break though\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/linux-ransomware-wide.jpeg?fit=600%2C315&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/linux-ransomware-wide.jpeg?fit=600%2C315&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/linux-ransomware-wide.jpeg?fit=600%2C315&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":240,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/15-most-basic-linux-commands\/","url_meta":{"origin":3225,"position":3},"title":"15 Most Basic Linux commands","author":"Daniel Draga","date":"July 30, 2016","format":false,"excerpt":"Linux is different, I know you already know that, and if are on this article you\u2019ve taken your first step into the amazin world of Linux OS (little exaggeration). Here I am going to provide a common command list most commonly used in Linux with their brief introduction. # 1:\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2016\/07\/unzip-cento.png?fit=505%2C250&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":884,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/linux-security-running-commands-safely\/","url_meta":{"origin":3225,"position":4},"title":"Linux Security: Running commands safely","author":"Daniel Draga","date":"January 27, 2017","format":false,"excerpt":"Security is an important but complex topic. So I'll be doing a series of articles, focusing on the principles and working of security of Linux. The challenge is that it\u2019s an ever-changing idea. Software we think of as secure can become insecure as hackers figure out how to break though\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/9.png?fit=1200%2C750&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/9.png?fit=1200%2C750&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/9.png?fit=1200%2C750&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/9.png?fit=1200%2C750&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/01\/9.png?fit=1200%2C750&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3392,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/locations-of-common-log-files-on-linux\/","url_meta":{"origin":3225,"position":5},"title":"Locations of Common Log Files on Linux","author":"George B.","date":"May 25, 2023","format":false,"excerpt":"In this tutorial, we will take you on a journey through the labyrinth of directories and unveil the secret locations of common log files on Linux. Whether you're a beginner or an experienced user, this guide will equip you with the knowledge to easily access and analyze these crucial logs.\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Locations-of-Common-Log-Files-on-Linux.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Locations-of-Common-Log-Files-on-Linux.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Locations-of-Common-Log-Files-on-Linux.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=3225"}],"version-history":[{"count":1,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3225\/revisions"}],"predecessor-version":[{"id":3228,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3225\/revisions\/3228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/3229"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=3225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=3225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=3225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}