{"id":13637,"date":"2024-10-10T13:25:46","date_gmt":"2024-10-10T13:25:46","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=13637"},"modified":"2026-02-26T14:02:09","modified_gmt":"2026-02-26T14:02:09","slug":"how-to-check-the-size-of-a-directory-in-linux","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/","title":{"rendered":"How to Check the Size of a Directory in Linux"},"content":{"rendered":"<p>In Linux, it\u2019s important to monitor the size of your directories to manage disk space effectively. This guide covers various methods to check the size of a directory using command-line tools.<\/p>\n<h5><strong>Follow the steps:<\/strong><\/h5>\n<ol>\n<li>Using the \u201cdu\u201d Command:<br \/>\nThe du (disk usage) command is the standard tool for checking the size of a directory and its contents.<\/p>\n<ul>\n<li>Basic usage: To check the size of a specific directory, use the following command:<br \/>\ndu -sh \/path\/to\/directory<\/p>\n<ul>\n<li>-s: Provides a summary of the directory size (i.e., not listing individual files).<\/li>\n<li>-h: Displays the size in a human-readable format (KB, MB, GB, etc.).<br \/>\nExample:<br \/>\ndu -sh \/var\/www<br \/>\nOutput:<br \/>\n200M \/var\/www<\/li>\n<\/ul>\n<\/li>\n<li>Display the size of all subdirectories: To see the size of a directory along with the size of its subdirectories, use:<br \/>\ndu -h \/path\/to\/directory<\/li>\n<\/ul>\n<\/li>\n<li>Using the \u201cls\u201d command:<br \/>\nWhile ls is generally used for listing files and directories, you can combine it with options to view file sizes.<\/p>\n<ul>\n<li>List files with their sizes:<br \/>\nls -lh \/path\/to\/directory<\/p>\n<ul>\n<li>\u2018-l\u2019: Displays a detailed list with file sizes.<\/li>\n<li>\u2018-h\u2019: Shows the sizes in a human-readable format.<br \/>\nHowever, note that \u2018ls\u2019 does not give you the total size of the directory; it only shows the size of individual files.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Using the \u201cdf\u201d Command:<br \/>\nThe \u2018df\u2019 (disk free) command shows the disk space usage for entire file systems. It is useful to check the available space on your system.<\/p>\n<ul>\n<li>Check available disk space:<br \/>\ndf -h \/path\/to\/directory<br \/>\nThis will display the amount of free space, total space, and used space for the file system where the directory resides.<\/li>\n<\/ul>\n<\/li>\n<li>Using the \u201cncdu\u201d Command (Optional):<br \/>\n\u2018ncdu\u2019 is a disk usage analyzer with a user-friendly interface. It can be installed on most Linux systems and offers more interactivity compared to du.<\/p>\n<ul>\n<li>Install \u2018ncdu\u2019:<br \/>\nsudo apt install ncdu\u00a0 # For Debian\/Ubuntu-based systems<br \/>\nsudo yum install ncdu\u00a0 # For RHEL\/CentOS-based systems<\/li>\n<li>Usage: To analyze a directory:<br \/>\nncdu \/path\/to\/directory<br \/>\n\u2018ncdu\u2019 will provide a navigable interface where you can see the size of directories and their contents.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Monitoring directory sizes in Linux helps keep your file system organized and prevents disk space issues. The \u2018du\u2019 command is the go-to tool, but alternatives like \u2018ls\u2019, \u2018df\u2019, and \u2018ncdu\u2019 can also offer valuable insights depending on your needs.<\/p>\n<p>We hope you found our article helpful. For more informative content, be sure to visit our Knowledge Base regularly.<\/p>\n<p>Are you facing issues deleting files and directories on a Linux system? This guide explains <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-delete-files-and-directories-on-linux\/\" target=\"_blank\" rel=\"noopener\">how to use command-line tools for the task<\/a>. Learn more by reading our article!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Linux, it\u2019s important to monitor the size of your directories to manage disk space effectively. This guide covers various methods to check the size of a directory using command-line&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837],"tags":[1576],"class_list":["post-13637","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-check-the-size-of-a-directory-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Check the Size of a Directory in Linux | bodHOST<\/title>\n<meta name=\"description\" content=\"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Check the Size of a Directory in Linux | bodHOST\" \/>\n<meta property=\"og:description\" content=\"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-10T13:25:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2024\/10\/How-to-Check-the-Size-of-a-Directory-in-Linux-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Serena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2024\/10\/How-to-Check-the-Size-of-a-Directory-in-Linux-2.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Serena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/\"},\"author\":{\"name\":\"Serena\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\"},\"headline\":\"How to Check the Size of a Directory in Linux\",\"datePublished\":\"2024-10-10T13:25:46+00:00\",\"dateModified\":\"2026-02-26T14:02:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/\"},\"wordCount\":440,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"Check the Size of a Directory in Linux\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/\",\"name\":\"How to Check the Size of a Directory in Linux | bodHOST\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2024-10-10T13:25:46+00:00\",\"dateModified\":\"2026-02-26T14:02:09+00:00\",\"description\":\"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-check-the-size-of-a-directory-in-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorial\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Check the Size of a Directory in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\",\"name\":\"Serena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"caption\":\"Serena\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/seema\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Check the Size of a Directory in Linux | bodHOST","description":"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Check the Size of a Directory in Linux | bodHOST","og_description":"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2024-10-10T13:25:46+00:00","article_modified_time":"2026-02-26T14:02:09+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2024\/10\/How-to-Check-the-Size-of-a-Directory-in-Linux-2.png","type":"image\/png"}],"author":"Serena","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2024\/10\/How-to-Check-the-Size-of-a-Directory-in-Linux-2.png","twitter_misc":{"Written by":"Serena","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/"},"author":{"name":"Serena","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830"},"headline":"How to Check the Size of a Directory in Linux","datePublished":"2024-10-10T13:25:46+00:00","dateModified":"2026-02-26T14:02:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/"},"wordCount":440,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["Check the Size of a Directory in Linux"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/","name":"How to Check the Size of a Directory in Linux | bodHOST","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2024-10-10T13:25:46+00:00","dateModified":"2026-02-26T14:02:09+00:00","description":"In this article, we have explained how to check the size of a directory in Linux to manage the disk space effectively.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-check-the-size-of-a-directory-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Tutorial","item":"https:\/\/www.bodhost.com\/kb\/category\/tutorial\/"},{"@type":"ListItem","position":2,"name":"How to Check the Size of a Directory in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830","name":"Serena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","caption":"Serena"},"url":"https:\/\/www.bodhost.com\/kb\/author\/seema\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13637","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=13637"}],"version-history":[{"count":4,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13637\/revisions"}],"predecessor-version":[{"id":13645,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13637\/revisions\/13645"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=13637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=13637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=13637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}