{"id":698,"date":"2016-11-24T00:00:00","date_gmt":"2016-11-24T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/vpshow-to-check-and-manage-disk-space-via-terminal\/"},"modified":"2025-03-25T19:49:22","modified_gmt":"2025-03-25T19:49:22","slug":"how-to-check-disk-space-in-linux","status":"publish","type":"post","link":"\/in\/tutorials\/how-to-check-disk-space-in-linux","title":{"rendered":"How to Check Disk Space Usage in Linux"},"content":{"rendered":"<p>In Linux, monitoring disk space is crucial for maintaining system performance and preventing insufficient storage issues, such as system crashes, data loss, and interrupted services.<\/p><p>We recommend regularly checking your Linux disk space if you manage a virtual private server (VPS), maintain databases, and run large-scale applications.<\/p><p>This article presents various commands and tools to check disk space usage in Linux. By reading this article, you can keep your system running efficiently and avoid potential problems.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"1024\" height=\"283\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet-1024x283.png\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-1536x425.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-300x83.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-150x41.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-768x212.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2><p>Before learning different methods to check disk space in Linux, you should have the following:<\/p><ul class=\"wp-block-list\">\n<li><strong>Linux CLI knowledge<\/strong>. A basic understanding of the Linux command-line interface will help you navigate through the commands and interpret their outputs.<\/li>\n\n\n\n<li><strong>Permission to run commands<\/strong>. Having administrative or root access is often required to execute some of the disk space management commands.<\/li>\n\n\n\n<li><strong>Terminal or SSH client applications<\/strong>. If you manage a remote or virtual server, make sure to use a terminal or <a href=\"\/in\/tutorials\/how-to-use-putty-ssh\">an SSH client like PuTTY<\/a> to access the server.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-how-to-check-disk-space-in-linux\">How to Check Disk Space in Linux<\/h2><p>Here are some <a href=\"\/in\/tutorials\/linux-commands\">Linux commands<\/a>, their basic syntax, and use cases to check your system&rsquo;s disk space. We&rsquo;ll also go over a dedicated method to monitor disk space for <a href=\"\/in\/vps-hosting\">Hostinger VPS<\/a> customers.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-check-disk-space-in-linux-using-the-df-command\">How to Check Disk Space in Linux Using the df Command<\/h3><p>The <strong>df<\/strong> command, short for disk free, is a standard Unix command used to display the amount of available disk space on file systems. The basic syntax of the <strong>df<\/strong> command is as follows:<\/p><pre class=\"wp-block-preformatted\">df [OPTIONS] [FILE]<\/pre><p>Some useful options include:<\/p><ul class=\"wp-block-list\">\n<li><strong>-h<\/strong>. Prints sizes in a human-readable format, such as KB, MB, and GB.<\/li>\n\n\n\n<li><strong>-a<\/strong>. Includes dummy file systems.<\/li>\n\n\n\n<li><strong>-T<\/strong>. Displays the file system type.<\/li>\n<\/ul><p>As an example, let&rsquo;s use:<\/p><pre class=\"wp-block-preformatted\">df -h<\/pre><p>This will output something like:<\/p><pre class=\"wp-block-preformatted\">Filesystem      Size  Used Avail Use% Mounted on\n\/dev\/sda1       100G   50G   45G  60% \/\ntmpfs           1.9G  1.2M  1.9G   1% \/dev\/shm\n\/dev\/sda2       200G  100G   90G  53% \/home<\/pre><p>Here is an explanation of each field:<\/p><ul class=\"wp-block-list\">\n<li><strong>Filesystem<\/strong>. The file system&rsquo;s name.<\/li>\n\n\n\n<li><strong>Size<\/strong>. The file system&rsquo;s total size.<\/li>\n\n\n\n<li><strong>Used<\/strong>. The amount of space used.<\/li>\n\n\n\n<li><strong>Avail<\/strong>. The amount of available space.<\/li>\n\n\n\n<li><strong>Use%<\/strong>. The percentage of space used.<\/li>\n\n\n\n<li><strong>Mounted on<\/strong>. The mount point of the file system.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-how-to-check-file-space-usage-in-linux-using-the-du-command\">How to Check File Space Usage in Linux Using the du Command<\/h3><p>The <strong>du<\/strong>, or disk usage command, estimates file space usage in Linux. It provides detailed information about the disk space used by files and directories.<\/p><p>The basic syntax of the <strong>du<\/strong> command is:<\/p><pre class=\"wp-block-preformatted\">du [OPTIONS] [FILE\/DIR]<\/pre><p>Here are some useful options you can apply:<\/p><ul class=\"wp-block-list\">\n<li><strong>-h<\/strong>. Shows sizes in a human-readable format.<\/li>\n\n\n\n<li><strong>-s<\/strong>. Summarizes the total for each argument.<\/li>\n\n\n\n<li><strong>-a<\/strong>. Includes files as well as directories.<\/li>\n<\/ul><p>To check the disk usage of a specific directory, use:<\/p><pre class=\"wp-block-preformatted\">du -h \/path\/to\/directory<\/pre><p>This command will list the sizes of all files and subdirectories within the specified directory.<\/p><p>For instance, if you run:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user<\/pre><p>You should see the following output:<\/p><pre class=\"wp-block-preformatted\">4.0K    \/home\/user\/Documents\n2.0M    \/home\/user\/Downloads\n500K    \/home\/user\/Pictures\n2.5M    \/home\/user<\/pre><p>If you only want to summarize the total disk usage of a directory, execute the following:<\/p><pre class=\"wp-block-preformatted\">du -sh \/path\/to\/directory<\/pre><p>This command provides a single total size for the specified directory.<\/p><p>Here&rsquo;s an example of its usage:<\/p><pre class=\"wp-block-preformatted\">du -sh \/home\/user<\/pre><p>The output should resemble the following:<\/p><pre class=\"wp-block-preformatted\">2.5M  \/home\/user<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-check-disk-usage-in-linux-using-the-pydf-command\">How to Check Disk Usage in Linux Using the pydf Command<\/h3><p>The Python-based <strong>pydf<\/strong> command displays the amount of disk space used and is available on all mounted file systems. Compared to the traditional <strong>df<\/strong> command, it provides a colorful and more readable output.<\/p><p>To install <strong>pydf<\/strong>, you can use your Linux distribution&rsquo;s package manager. For example, on Debian or Ubuntu-based systems, run:<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install pydf<\/pre><p>For Red Hat or CentOS-based systems, you might need to enable the EPEL repository beforehand:<\/p><pre class=\"wp-block-preformatted\">sudo yum install epel-release\nsudo yum install pydf<\/pre><p>Once installed, familiarize yourself with its basic syntax:<\/p><pre class=\"wp-block-preformatted\">pydf [OPTIONS]<\/pre><p>Some common options to use include:<\/p><ul class=\"wp-block-list\">\n<li><strong>-h<\/strong>. Prints sizes in KB, MB, or GB.<\/li>\n\n\n\n<li><strong>-v<\/strong>. Displays the version information.<\/li>\n<\/ul><p>To check disk usage with <strong>pydf<\/strong>, you can execute:<\/p><pre class=\"wp-block-preformatted\">pydf -h<\/pre><p>This will produce an output similar to:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/terminal-pydf-command-output.png\"><img decoding=\"async\" width=\"1024\" height=\"167\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/terminal-pydf-command-output-1024x167.png\" alt=\"The pydf command's output\" class=\"wp-image-111054\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output-1024x167.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output-300x49.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output-150x25.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output-768x126.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output-1536x251.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-pydf-command-output.png 1590w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Meanwhile, the <strong>df <\/strong>command produces:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/terminal-df-command-output.png\"><img decoding=\"async\" width=\"738\" height=\"232\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/terminal-df-command-output.png\" alt=\"The df command's output\" class=\"wp-image-111055\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-df-command-output.png 738w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-df-command-output-300x94.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/terminal-df-command-output-150x47.png 150w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/a><\/figure><\/div><p>The <strong>pydf <\/strong>command&rsquo;s output is more colorful, which can be more user-friendly for those who prefer a visual representation of disk usage.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-check-disk-usage-in-linux-using-the-ncdu-command\">How to Check Disk Usage in Linux Using the ncdu Command<\/h3><p>The NCurses Disk Usage (<strong>ncdu<\/strong>) command is a disk usage analyzer with an ncurses interface. It provides an interactive way to view and manage disk usage, suitable for identifying large files and directories.<\/p><p>To install <strong>ncdu<\/strong> on Debian or Ubuntu, run:<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install ncdu<\/pre><p>If you use a Red Hat or CentOS-based distribution, use:<\/p><pre class=\"wp-block-preformatted\">sudo yum install ncdu<\/pre><p>The basic syntax of the <strong>ncdu<\/strong> command is:<\/p><pre class=\"wp-block-preformatted\">ncdu [OPTIONS] [DIRECTORY]<\/pre><p>To start <strong>ncdu<\/strong> and analyze the current directory, you can run:<\/p><pre class=\"wp-block-preformatted\">ncdu<\/pre><p>This will launch <strong>ncdu<\/strong> in interactive mode, where you can access directories and view disk usage with the following keys:<\/p><ul class=\"wp-block-list\">\n<li><strong>Up\/down arrows<\/strong>. Navigate through the list of files and directories.<\/li>\n\n\n\n<li><strong>Enter<\/strong>. Open a directory to view its contents.<\/li>\n\n\n\n<li><strong>D<\/strong>. Delete the selected file or directory.<\/li>\n\n\n\n<li><strong>Q<\/strong>. Quit <strong>ncdu<\/strong>.<\/li>\n<\/ul><p>For instance, if you run:<\/p><pre class=\"wp-block-preformatted\">ncdu \/home\/user<\/pre><p>It will produce:<\/p><pre class=\"wp-block-preformatted\">--- \/home\/user --------------------\n. 2.5 GiB [##########] \/Downloads\n. 1.5 GiB [######....] \/Documents\n. 500 MiB [##........] \/Pictures\n. 100 MiB [..........] \/Music<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-list-block-devices-in-linux-using-the-lsblk-command\">How to List Block Devices in Linux Using the lsblk Command<\/h3><p>The <strong>lsblk<\/strong> command displays information about all available or specified block devices. While its primary purpose is to show your system&rsquo;s storage configuration, <strong>lsblk<\/strong> can also provide details about disk space and partition sizes.<\/p><p>Here&rsquo;s the basic syntax of the <strong>lsblk<\/strong> command:<\/p><pre class=\"wp-block-preformatted\">lsblk [OPTIONS]<\/pre><p>Some options you can add include:<\/p><ul class=\"wp-block-list\">\n<li><strong>-a<\/strong>. Lists all devices, including empty ones.<\/li>\n\n\n\n<li><strong>-f<\/strong>. Displays file system information.<\/li>\n\n\n\n<li><strong>-l<\/strong>. Uses list format output.<\/li>\n\n\n\n<li><strong>-o<\/strong>. Specifies which columns to display.<\/li>\n<\/ul><p>For instance, running <strong>lsblk -f<\/strong> will produce an output similar to:<\/p><pre class=\"wp-block-preformatted\">NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  100G  0 disk \n&#9500;&#9472;sda1   8:1    0   50G  0 part \/\n&#9492;&#9472;sda2   8:2    0   50G  0 part \/home\nsdb      8:16   0  200G  0 disk \n&#9492;&#9472;sdb1   8:17   0  200G  0 part \/data<\/pre><p>Here&rsquo;s an explanation of each field:<\/p><ul class=\"wp-block-list\">\n<li><strong>NAME<\/strong>. The device&rsquo;s name.<\/li>\n\n\n\n<li><strong>MAJ:MIN<\/strong>. The major and minor device numbers.<\/li>\n\n\n\n<li><strong>RM<\/strong>. Indicates if the device is removable (1) or not (0).<\/li>\n\n\n\n<li><strong>SIZE<\/strong>. The device&rsquo;s size.<\/li>\n\n\n\n<li><strong>RO<\/strong>. Indicates if the device is read-only (1) or not (0).<\/li>\n\n\n\n<li><strong>TYPE<\/strong>. The device&rsquo;s type, such as disk or part.<\/li>\n\n\n\n<li><strong>MOUNTPOINT<\/strong>. Where the device is mounted in the file system.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-how-to-get-detailed-file-information-in-linux-using-the-stat-command\">How to Get Detailed File Information in Linux Using the stat Command<\/h3><p>The <strong>stat<\/strong> command presents detailed information about specific files and file systems. It provides various metadata, such as file size, access permissions, and modification time, making it a powerful tool for analyzing files.<\/p><p>Its basic syntax is as follows:<\/p><pre class=\"wp-block-preformatted\">stat [OPTIONS] [FILE]<\/pre><p>There are some options you can append to <strong>stat<\/strong>, such as:<\/p><ul class=\"wp-block-list\">\n<li><strong>-c<\/strong>. Allows custom formatting of the output.<\/li>\n\n\n\n<li><strong>-f<\/strong>. Displays information about the file system instead of the file.<\/li>\n<\/ul><p>To get detailed information about a file system, execute the following:<\/p><pre class=\"wp-block-preformatted\">stat -f \/path\/to\/mountpoint<\/pre><p>For example:<\/p><pre class=\"wp-block-preformatted\">stat -f \/<\/pre><p>It will display details about the file system where the root directory is mounted:<\/p><pre class=\"wp-block-preformatted\">File: \"\/\"\nID: 1234abcd5678ef90 Namelen: 255     Type: ext4\nBlock size: 4096       Fundamental block size: 4096\nBlocks: Total: 5242880  Free: 1024000   Available: 1000000\nInodes: Total: 2621440  Free: 2000000<\/pre><p>Here are the fields and their explanations:<\/p><ul class=\"wp-block-list\">\n<li><strong>File<\/strong>. The file system&rsquo;s name.<\/li>\n\n\n\n<li><strong>ID<\/strong>. The file system ID in the hexadecimal format.<\/li>\n\n\n\n<li><strong>Namelen<\/strong>. The maximum length of file names.<\/li>\n\n\n\n<li><strong>Type<\/strong>. The file system&rsquo;s type, such as ext4 or xfs.<\/li>\n\n\n\n<li><strong>Block size<\/strong>. Each block&rsquo;s size in bytes.<\/li>\n\n\n\n<li><strong>Blocks: Total<\/strong>. The file system&rsquo;s total number of blocks.<\/li>\n\n\n\n<li><strong>Free<\/strong>. The number of free blocks in the file system in KB or MB.<\/li>\n\n\n\n<li><strong>Available<\/strong>. The number of available blocks for non-superusers in KB or MB.<\/li>\n\n\n\n<li><strong>Inodes: Total<\/strong>. The total number of inodes in the file system.<\/li>\n\n\n\n<li><strong>Free<\/strong>. The number of free inodes in the file system.<\/li>\n<\/ul><p>Alternatively, use <strong>Kodee<\/strong> AI assistant to check your file&rsquo;s stats. To access the tool, <a href=\"https:\/\/hpanel.hostinger.com\" target=\"_blank\" rel=\"noopener\">open hPanel<\/a> and click <strong>Manage<\/strong> on your VPS. Navigate to the sidebar and select <strong>Kodee<\/strong>. In the prompt field, simply ask a question like &ldquo;Can you check the stats of file1.zip?&rdquo;<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69e1f75108682\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/11\/hpanel-vps-kodee-stat-1024x602.png\" alt=\"Kodee responds to a question about file stats\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-how-to-check-disk-space-in-hostinger-vps\">How to Check Disk Space in Hostinger VPS<\/h3><p>Our clients can easily check their Linux server&rsquo;s disk space usage through hPanel. Here are the steps:<\/p><ol class=\"wp-block-list\">\n<li>Log in to hPanel with your Hostinger account and go to <strong>VPS &rarr; Manage<\/strong>.<\/li>\n\n\n\n<li>On the Overview screen, locate the <strong>Disk usage<\/strong> panel to see an overview of free and total disk usage.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69e1f75109fe0\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"367\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-1024x367.png\" alt=\"Hostinger's VPS Overview section with disk usage highlighted\" class=\"wp-image-125751\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-1024x367.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-300x108.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-150x54.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-768x275.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted-1536x551.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/hostinger-vps-overview-section-with-disk-usage-highlighted.png 1830w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click the <strong>Disk Usage<\/strong> section to monitor disk space usage over specific periods, such as daily, weekly, monthly, and annually.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hpanel-vps-server-usage.png\"><img decoding=\"async\" width=\"1024\" height=\"474\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hpanel-vps-server-usage-1024x474.png\" alt=\"The Disk Space statistic on the Server Usage page\" class=\"wp-image-111057\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-1024x474.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-300x139.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-150x70.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-768x356.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-1536x712.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-server-usage-2048x949.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>You can also ask <strong>Kodee<\/strong> questions like &ldquo;Check the current disk usage of my VPS&rdquo; or &ldquo;Check the block devices on my VPS.&rdquo;<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69e1f7510cbb7\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"474\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices-1024x474.png\" alt=\"Kodee outputs the VPS current disk consumption and block devices\" class=\"wp-image-122355\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices-1024x474.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices-300x139.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices-150x69.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices-768x356.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2016\/11\/kodee-shows-the-vps-current-disk-usage-and-block-devices.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you prefer to run Linux commands to check your server&rsquo;s disk space, you can use our built-in <strong>Browser terminal<\/strong>. Here, you can execute commands similar to those used in Terminal or SSH applications.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"91\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-1024x91.png\" alt=\"The Browser terminal feature in the VPS dashboard\" class=\"wp-image-111058\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-1024x91.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-300x27.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-150x13.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-768x68.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-1536x136.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hpanel-vps-overview-browser-terminal-highlighted-2048x181.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>To access it, click <strong>Browser terminal<\/strong> in your VPS dashboard. Then, log in using your SSH credentials and start executing the commands.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hostinger-browser-terminal.png\"><img decoding=\"async\" width=\"1024\" height=\"453\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/hostinger-browser-terminal-1024x453.png\" alt=\"Running a command in Hostinger's Browser terminal\" class=\"wp-image-111059\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal-1024x453.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal-300x133.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal-150x66.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal-768x339.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal-1536x679.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/06\/hostinger-browser-terminal.png 1602w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/in\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-how-to-combine-commands-when-checking-disk-space\">How to Combine Commands When Checking Disk Space<\/h2><p>Combining commands can provide more detailed and customized information about your disk space usage. Here are some examples you can follow:<\/p><h3 class=\"wp-block-heading\" id=\"h-how-to-sort-files-by-size\">How to Sort Files by Size<\/h3><p>To sort files by size, you can run the <strong>du<\/strong> command to list files and folders in a readable format. Then, pipe the result to the <strong>sort<\/strong> command with the <strong>-rh<\/strong> option to sort them in descending order by size.<\/p><p>Here&rsquo;s how the combination looks when targeting the <strong>\/home\/user<\/strong> directory:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user | sort -rh<\/pre><p>You can also add the <a href=\"\/in\/tutorials\/how-to-use-tail-command\">tail command<\/a> to display the smallest files and folders. For example, run the following to display the three items with the lowest size:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user | sort -rh | tail -3<\/pre><p>Here&rsquo;s the expected output:<\/p><pre class=\"wp-block-preformatted\">200M    \/home\/user\/Images\n500M    \/home\/user\/Documents\n1.5G    \/home\/user\/Projects<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-exclude-files-by-size\">How to Exclude Files by Size<\/h3><p>If you want to see all files beyond a specific size, consider combining the <strong>du<\/strong> and <a href=\"\/in\/tutorials\/grep-command-in-linux-useful-examples\">grep commands<\/a>. This allows you to filter out files based on their size.<\/p><p>For instance, to list all files larger than 1 GB in the <strong>\/home\/user directory<\/strong>, execute:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user | grep '^\\s*[0-9\\.]\\+G'<\/pre><p>If you want to list files larger than 1 MB, replace <strong>G<\/strong> with <strong>M<\/strong>:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user | grep '^\\s*[0-9\\.]\\+M'<\/pre><p>You should see:<\/p><pre class=\"wp-block-preformatted\">500M    \/home\/user\/Documents\n200M    \/home\/user\/Images<\/pre><h3 class=\"wp-block-heading\" id=\"h-how-to-exclude-file-types\">How to Exclude File Types<\/h3><p>If you want to exclude a particular file type from the search results, you can use the <strong>du<\/strong> command with the <strong>&ndash;exclude<\/strong> option. Here&rsquo;s an example:<\/p><pre class=\"wp-block-preformatted\">du -h \/home\/user --exclude= \"*.txt\"<\/pre><p>The output will display all file formats in <strong>\/home\/user<\/strong> except <strong>TXT<\/strong> documents:<\/p><pre class=\"wp-block-preformatted\">2.0G    \/home\/user\/Videos\n1.5G    \/home\/user\/Projects\n500M    \/home\/user\/Documents\n200M    \/home\/user\/Images<\/pre><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>In this article, we covered various commands to check disk space usage in Linux. The <strong>df<\/strong> and <strong>pydf<\/strong> commands provide an overview of storage usage, while <strong>du<\/strong> helps you see the space used by specific directories and files.<\/p><p>We also discussed how to combine commands for more detailed analysis, such as using <strong>du<\/strong> and <strong>grep<\/strong> to exclude files by size. By practicing these commands, you can efficiently manage your space, keep your Linux system running smoothly, and prevent storage-related issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Linux, monitoring disk space is crucial for maintaining system performance and preventing insufficient storage issues, such as system crashes, data loss, and interrupted services. We recommend regularly checking your Linux disk space if you manage a virtual private server (VPS), maintain databases, and run large-scale applications. This article presents various commands and tools to [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/how-to-check-disk-space-in-linux\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22644,22640],"tags":[],"class_list":["post-698","post","type-post","status-publish","format-standard","hentry","category-managing-monitoring-and-security","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/espace-disque-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/revisar-espacio-en-el-disco-linux","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-check-disk-space-usage-di-linux","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/revisar-espacio-en-el-disco-linux","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/revisar-espacio-en-el-disco-linux","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/revisar-espacio-en-el-disco-linux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-check-disk-space-in-linux","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-check-disk-space-in-linux","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=698"}],"version-history":[{"count":32,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"predecessor-version":[{"id":125755,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/698\/revisions\/125755"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}