{"id":12314,"date":"2026-02-24T10:41:49","date_gmt":"2026-02-24T05:11:49","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=12314"},"modified":"2026-02-24T10:42:59","modified_gmt":"2026-02-24T05:12:59","slug":"check-disk-space-files-in-linux","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/check-disk-space-files-in-linux","title":{"rendered":"How to Check Disk Space &amp; Files in Linux (df &amp; du Commands Guide 2026)"},"content":{"rendered":"\n<p><strong>To check disk space and files in Linux<\/strong>, use <code>df -h<\/code> to see filesystem usage, <code>du -sh<\/code> to measure directories, and <code>find \/ -type f -size +1G<\/code> to locate large files. Combine these with tools like <code>ncdu<\/code>, inodes checks (<code>df -i<\/code>), and log cleanup (<code>journalctl --vacuum-size<\/code>) to analyze and free space safely.<\/p>\n\n\n\n<p>Managing storage efficiently starts with knowing how to check disk space in Linux and quickly pinpoint what\u2019s consuming it. In this guide, I\u2019ll show you practical, reliable methods used in real production servers to measure disk usage, find large files, understand df vs du, and clean up space without breaking your system.<\/p>\n\n\n\n<p>Whether you\u2019re on a VPS, dedicated server, or local machine, this is the workflow that works.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"fast-reference-commands-youll-use-most\">Fast Reference: Commands You\u2019ll Use Most<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2496\" height=\"1664\" src=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-29.png\" alt=\"Check Disk Space &amp; Files in Linux\" class=\"wp-image-12479\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-29.png 2496w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-29-150x100.png 150w\" sizes=\"auto, (max-width: 2496px) 100vw, 2496px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check filesystem usage:<\/strong> <code>df -hT<\/code> (human-readable, show filesystem type)<\/li>\n\n\n\n<li><strong>Check inode usage: <\/strong><code>df -i<\/code><\/li>\n\n\n\n<li><strong>Top-level directory sizes:<\/strong> <code>du -sh \/*<\/code><\/li>\n\n\n\n<li><strong>Sort directories by size: <\/strong><code>du -sh * | sort -h<\/code><\/li>\n\n\n\n<li><strong>Limit to one filesystem:<\/strong> <code>du -x \/<\/code><\/li>\n\n\n\n<li><strong>Interactive analyzer: <\/strong><code>ncdu \/<\/code><\/li>\n\n\n\n<li><strong>Find large files (&gt;1 GB):<\/strong> <code>find \/ -xdev -type f -size +1G -printf \"%s %p\\n\" | sort -nr | head -50<\/code><\/li>\n\n\n\n<li><strong>Check orphaned (deleted but open) files:<\/strong> <code>lsof +L1<\/code><\/li>\n\n\n\n<li><strong>Check journal size:<\/strong> <code>journalctl --disk-usage<\/code>; reduce: <code>journalctl --vacuum-size=500M<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"understanding-disk-usage-in-linux-df-vs-du-inodes-mounts\">Understanding Disk Usage in Linux (df vs du, inodes, mounts)<\/h2>\n\n\n\n<p>Before diving into commands, a quick orientation helps you avoid common mistakes and save time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"df-vs-du-whats-the-difference\"><strong>df vs du: What\u2019s the difference?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>df (disk free):<\/strong> Shows free and used space per <em>mounted filesystem<\/em>. It reads filesystem metadata\u2014great for \u201chow full is this disk?\u201d<\/li>\n\n\n\n<li><strong>du (disk usage):<\/strong> Calculates the actual <a href=\"https:\/\/www.youstable.com\/blog\/how-to-increase-file-upload-size-in-cpanel\/\">size of <em>files<\/em><\/a> and directories by walking the filesystem. Ideal for \u201cwhich directory is big?\u201d<\/li>\n<\/ul>\n\n\n\n<p>They can disagree if files were deleted but still held open by processes, or when snapshot\/overlay filesystems (e.g., Docker, Btrfs) are involved. Always reconcile with <code>lsof +L1<\/code>, snapshots, and container storage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"inodes-and-why-they-matter\">Inodes and why they matter<\/h3>\n\n\n\n<p>Each file uses an inode. You can have free space but no free inodes, causing writes to fail. Check with <code>df -i<\/code>. Millions of tiny files (cache\/temp files) commonly exhaust inodes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"mount-points-and-staying-on-one-disk\">Mount points and staying on one disk<\/h3>\n\n\n\n<p>Use <code>lsblk -f<\/code> to see disks, mount points, and filesystem types. When analyzing, limit traversal to a single filesystem with <code>-x<\/code> in <code>du<\/code> or <code>-xdev<\/code> in <code>find<\/code> to avoid crossing onto other mounts like <code>\/boot<\/code>, <code>\/home<\/code>, <code>\/var<\/code>, NFS, or Docker overlay layers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"check-disk-space-with-df\">Check Disk Space with df<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"the-essential-df-commands\">The essential df commands<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Human-readable disk usage with filesystem type\ndf -hT\n\n# Exclude temporary filesystems\ndf -hTx tmpfs -x devtmpfs\n\n# Show inode usage\ndf -i\n\n# Focus on a specific mount (e.g., root)\ndf -hT \/<\/code><\/pre>\n\n\n\n<p>Interpretation tips: Watch for <code>Use%<\/code> crossing 80\u201390%. For critical servers, alert at 80% to avoid performance degradation or write failures. Check unexpected mounts (e.g., overlay, loop devices from snaps or ISO mounts) that may skew usage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"spot-the-filesystem-type-and-implications\">Spot the filesystem type and implications<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ext4\/xfs: <\/strong>Common on servers. Ext4 reserves space for root by default (often 5%). You can adjust with <code>tune2fs -m 1 \/dev\/yourdev<\/code> (use carefully, root required).<\/li>\n\n\n\n<li><strong>btrfs:<\/strong> Snapshots and subvolumes can consume space even if files look deleted. Use <code>btrfs filesystem df \/<\/code> and manage snapshots.<\/li>\n\n\n\n<li><strong>zfs:<\/strong> Datasets and snapshots require ZFS-specific tools.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"analyze-directory-sizes-with-du\">Analyze Directory Sizes with du<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"top-down-discovery\">Top down discovery<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Size of root directories (top level)\nsudo du -sh \/* 2&gt;\/dev\/null | sort -h\n\n# Drill into a heavy directory, e.g., \/var\nsudo du -sh \/var\/* 2&gt;\/dev\/null | sort -h\n\n# Show summary only\ndu -sh \/home\/user\n\n# Limit to one filesystem to avoid crossing mounts\nsudo du -x -h \/ 2&gt;\/dev\/null | sort -h | tail -20<\/code><\/pre>\n\n\n\n<p>Use <code>du -sh *<\/code> inside a suspected directory to quickly identify growth. The <code>2&gt;\/dev\/null<\/code> suppresses permission errors; prepend <code>sudo<\/code> as needed on servers to get complete results.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"exclude-patterns-and-control-depth\">Exclude patterns and control depth<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Exclude cache and VCS directories\ndu -sh --exclude=\"*.cache\" --exclude=\".git\" \/path\n\n# Limit depth to show just top N levels\ndu -h --max-depth=1 \/var | sort -h<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"interactive-analysis-with-ncdu\">Interactive analysis with ncdu<\/h3>\n\n\n\n<p><code>ncdu<\/code> is a curses-based disk analyzer that\u2019s fast and user-friendly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Install and run ncdu (Debian\/Ubuntu)\nsudo apt update &amp;&amp; sudo apt install -y ncdu\nsudo ncdu \/\n\n# RHEL\/CentOS\/AlmaLinux\nsudo dnf install -y ncdu\nsudo ncdu \/<\/code><\/pre>\n\n\n\n<p>Navigate with arrow keys and drill down to large directories. This is my go-to for quick triage on <a href=\"https:\/\/www.youstable.com\/blog\/cloud-server-vs-dedicated-server\/\">busy servers<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"find-large-files-and-whats-growing\">Find Large Files and What\u2019s Growing<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"locate-big-files-reliably\">Locate big files reliably<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Largest files (&gt;=1G) on the current filesystem\nsudo find \/ -xdev -type f -size +1G -printf \"%s %p\\n\" 2&gt;\/dev\/null | sort -nr | head -50\n\n# Human-friendly listing with ls -lh after finding candidates\nsudo find \/var -type f -size +500M -exec ls -lh {} \\; 2&gt;\/dev\/null | sort -k5 -h<\/code><\/pre>\n\n\n\n<p>Common culprits: database dumps, media archives, tarballs in <code>\/root<\/code> or <code>\/home<\/code>, VM images under <code>\/var\/lib\/libvirt<\/code>, Docker layers, and logs under <code>\/var\/log<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"log-files-and-systemd-journald\">Log files and systemd journald<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># See how much space journald uses\njournalctl --disk-usage\n\n# Cap logs to 500 MB total\nsudo journalctl --vacuum-size=500M\n\n# Or keep only last 7 days\nsudo journalctl --vacuum-time=7d<\/code><\/pre>\n\n\n\n<p>Also inspect classic logs: \/var\/log\/*.log, rotated logs (.gz), and application logs (Nginx, Apache, <a href=\"https:\/\/www.youstable.com\/blog\/mysql-commands\">MySQL<\/a>, Node). Ensure logrotate is <a href=\"https:\/\/www.youstable.com\/blog\/how-to-configure-professional-emails-with-outlook\/\">configured for your services and set<\/a> sane retention.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"deleted-but-still-consuming-space-orphaned-files\">Deleted but still consuming space (orphaned files)<\/h3>\n\n\n\n<p>When a process holds an open file that\u2019s been deleted, <code>df<\/code> shows high usage but you won\u2019t see it with <code>du<\/code>. Identify with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Show deleted-but-open files\nsudo lsof +L1 | grep -i deleted<\/code><\/pre>\n\n\n\n<p>Restart the offending service to release the handle (e.g., <code>sudo systemctl restart nginx<\/code>). Truncating log files is also safe if the process is still writing: <code>: &gt; \/path\/to\/logfile<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"special-cases-docker-snap-flatpak-databases\">Special Cases: Docker, Snap, Flatpak, Databases<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"docker-and-container-storage\">Docker and container storage<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># See Docker disk usage summary\nsudo docker system df\n\n# Remove unused images\/containers\/networks (review carefully)\nsudo docker system prune -af --volumes<\/code><\/pre>\n\n\n\n<p>On hosts with heavy container churn, orphaned layers and volumes can balloon <code>\/var\/lib\/docker<\/code>. Prune only if you understand the impact. For Kubernetes, use cluster-aware cleanup or node maintenance windows.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"snap-and-flatpak\">Snap and Flatpak<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Snap old revisions\nsnap list --all | <a href=\"https:\/\/www.youstable.com\/blog\/awk-command\">awk<\/a> '\/disabled\/{print $1, $3}' | while read snapname revision; do sudo snap remove \"$snapname\" --revision=\"$revision\"; done\n\n# Flatpak cleanup\nflatpak uninstall --unused -y\nflatpak remove --delete-data &lt;app-id&gt;<\/code><\/pre>\n\n\n\n<p>Snaps maintain multiple revisions by default; removing disabled ones reclaims space. Flatpak caches and runtimes also grow over time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"databases-and-backups\">Databases and backups<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>MySQL\/MariaDB: <\/strong>Check <code>\/var\/lib\/mysql<\/code>; huge <code>ibdata<\/code> or binary logs can grow rapidly. Rotate binlogs and size your InnoDB logs.<\/li>\n\n\n\n<li><strong>PostgreSQL: <\/strong>Inspect <code>\/var\/lib\/postgresql<\/code> and <code>pg_wal<\/code>; long-running transactions can block cleanup.<\/li>\n\n\n\n<li><strong>Backups:<\/strong> Move archives off the root disk. Compress with <code>zstd<\/code> or <code>xz<\/code> for better ratios when CPU allows.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"clean-up-disk-space-safely\">Clean Up Disk Space Safely<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"package-caches\">Package caches<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Debian\/Ubuntu\nsudo apt-get autoremove -y\nsudo apt-get clean\nsudo apt-get autoclean\n\n# RHEL\/CentOS\/AlmaLinux\nsudo dnf autoremove -y\nsudo dnf clean all<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"logs-and-temp-files\">Logs and temp files<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Rotate and compress logs\nsudo logrotate -f \/etc\/logrotate.conf\n\n# Clear system temp (systemd)\nsudo systemd-tmpfiles --clean\n\n# Truncate a large log safely\n: &gt; \/var\/log\/app\/app.log<\/code><\/pre>\n\n\n\n<p>Avoid deleting entire log directories; services expect paths to exist. Prefer rotation and truncation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"old-kernels-when-using-package-managed-kernels\">Old kernels (when using package managed kernels)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian example (review output before removing)\ndpkg --list | grep linux-image\nsudo apt-get autoremove --purge -y<\/code><\/pre>\n\n\n\n<p>Ensure the running kernel is not removed. Leave at least one known-good kernel for rollback.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"large-caches-language-runtimes-and-build-tools\">Large caches: language runtimes and build tools<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Node.js: <\/strong><code>npm cache clean --force<\/code>, remove <code>node_modules<\/code> in old builds.<\/li>\n\n\n\n<li><strong>Python: <\/strong>prune <code>~\/.cache\/pip<\/code>, virtualenvs no longer used.<\/li>\n\n\n\n<li><strong>Composer: <\/strong><code>composer clear-cache<\/code>.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"proactive-monitoring-and-alerts\">Proactive Monitoring and Alerts<\/h2>\n\n\n\n<p>Set early warnings so you never wake up to a full disk. A simple cron based script can email you when usage crosses thresholds.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env bash\nset -euo pipefail\nTHRESHOLD=80\nALERT=\"ops@example.com\"\n\ndf -hP -x tmpfs -x devtmpfs | awk -v t=\"$THRESHOLD\" '\nNR&gt;1 {gsub(\"%\",\"\",$5); if ($5 &gt;= t) printf \"ALERT: %s is at %s%% on %s\\n\",$6,$5,$1 }' | \\\nwhile read -r line; do\n  echo \"$line\" | mail -s \"Disk Space Alert\" \"$ALERT\"\ndone<\/code><\/pre>\n\n\n\n<p>On managed servers at <strong><a href=\"https:\/\/www.youstable.com\/\">YouStable<\/a><\/strong>, we pair OS-level alerts with platform monitoring and proactive support, so disk anomalies are caught before they impact uptime. If you\u2019re running critical workloads, <a href=\"https:\/\/www.youstable.com\/blog\/why-should-you-consider-windows-dedicated-server-hosting\/\">consider a managed VPS or dedicated server<\/a> plan with built-in monitoring and 24\/7 response.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"troubleshooting-tips-from-real-world-servers\">Troubleshooting Tips from Real World Servers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"when-df-and-du-dont-match\">When df and du don\u2019t match<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check deleted-open files:<\/strong> <code>lsof +L1<\/code>.<\/li>\n\n\n\n<li><strong>Confirm mount points:<\/strong> <code>mount | column -t<\/code>, <code>lsblk -f<\/code>.<\/li>\n\n\n\n<li>Consider snapshots (Btrfs\/ZFS) or container overlays affecting <code>df<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"inode-exhaustion\">Inode exhaustion<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Find directories with many small files: <\/strong><code>sudo find \/var -xdev -type f | sed -n '1,5p'<\/code> and analyze hot paths with <code>du --inodes -d1 \/var | sort -n<\/code> (if supported).<\/li>\n\n\n\n<li>Clean app caches, temp upload dirs, and session stores.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"filesystem-errors-or-sudden-space-drop\">Filesystem errors or sudden space drop<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check <code>dmesg<\/code> and <code>journalctl -k<\/code> for disk I\/O errors.<\/li>\n\n\n\n<li>Run <code>fsck<\/code> on unmounted filesystems during maintenance windows.<\/li>\n\n\n\n<li>On ext4, consider adjusting reserved blocks: <code>sudo tune2fs -m 1 \/dev\/sdXN<\/code> for non-root data volumes (do not set to 0 on OS partitions without understanding the risk).<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"a-practical-workflow-to-check-disk-space-and-files\">A Practical Workflow to Check Disk Space and Files<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1:<\/strong> <code>df -hT<\/code> to identify the full filesystem and type.<\/li>\n\n\n\n<li><strong>Step 2:<\/strong> <code>df -i<\/code> to rule out inode issues.<\/li>\n\n\n\n<li><strong>Step 3: <\/strong><code>du -sh \/* | sort -h<\/code> to find the largest top-level directories.<\/li>\n\n\n\n<li><strong>Step 4:<\/strong> Drill down with <code>du -sh \/var\/* | sort -h<\/code>, then <code>du -sh \/var\/log\/*<\/code> or <code>\/var\/lib\/*<\/code>.<\/li>\n\n\n\n<li><strong>Step 5:<\/strong> <code>find<\/code> large files; verify logs and database folders.<\/li>\n\n\n\n<li><strong>Step 6: <\/strong>Handle special cases (journald, Docker, snaps, backups).<\/li>\n\n\n\n<li><strong>Step 7: <\/strong>Clean safely (rotate, truncate, prune caches, remove unused kernels\/images).<\/li>\n\n\n\n<li><strong>Step 8:<\/strong> Add monitoring and review growth trends monthly.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs\">FAQs<\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765514002687\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-check-disk-space-in-linux-in-one-command\">How do I check disk space in Linux in one command?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use <code>df -hT<\/code> for a clear overview of all mounted filesystems, their sizes, used\/free space, and types. To check a specific mount, append its path: <code>df -hT \/<\/code>.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514010618\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"whats-the-difference-between-df-and-du\">What\u2019s the difference between df and du?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p><code>df<\/code> reads filesystem metadata to show free\/used space per mount; <code>du<\/code> walks directories to measure file sizes. If they disagree, look for deleted open files, snapshots, or overlay filesystems (Docker).<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514017882\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-find-large-files-in-linux-quickly\">How do I find large files in Linux quickly?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run <code>sudo find \/ -xdev -type f -size +1G -printf \"%s %p\\n\" | sort -nr | head<\/code>. Then verify with <code>ls -lh<\/code> and clean or archive as appropriate. Use <code>ncdu<\/code> for an interactive view.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514022837\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-can-i-clean-up-logs-safely\">How can I clean up logs safely?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use <code>logrotate<\/code> to rotate\/compress logs and <code>journalctl --vacuum-size<\/code> for systemd journals. To immediately shrink a giant log, truncate it: <code>: &gt; \/path\/to\/log.log<\/code>. Avoid deleting log directories.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514038236\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"why-does-df-show-full-but-du-doesnt\">Why does df show full but du doesn\u2019t?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Likely deleted files held open by a running process. Check with <code>lsof +L1<\/code> and restart the offending service. Snapshots and container layers can also cause mismatches.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514045704\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-check-inode-usage\">How do I check inode usage?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run <code>df -i<\/code>. If inodes are near 100%, find and remove directories with many small files (caches, sessions, temporary uploads). Consider consolidating tiny files or changing storage strategy.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765514053238\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"whats-the-safest-way-to-free-space-on-a-production-server\">What\u2019s the safest way to free space on a production server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Take backups, identify large consumers with <code>du<\/code>\/<code>find<\/code>, rotate\/truncate logs, prune package and application caches, and remove only unused images\/kernels. Test cleanup steps in staging if possible and schedule maintenance for restarts.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>With the right workflow <code>df<\/code> for the big picture, <code>du<\/code>\/<code>ncdu<\/code> for drilling down, and targeted cleanup, you can confidently check disk space in Linux and prevent outages. <\/p>\n\n\n\n<p>If you\u2019d rather focus on your apps, <a href=\"https:\/\/www.youstable.com\/blog\/benefits-of-fully-managed-dedicated-server\/\">YouStable\u2019s managed VPS and dedicated servers<\/a> include proactive monitoring and expert help, so storage stays healthy and your uptime stays intact.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To check disk space and files in Linux, use df -h to see filesystem usage, du -sh to measure directories, [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15130,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[350,1195],"tags":[],"class_list":["post-12314","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase","category-blogging"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Check-Disk-Space-Files-in-Linux.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=12314"}],"version-history":[{"count":7,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12314\/revisions"}],"predecessor-version":[{"id":19002,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/12314\/revisions\/19002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15130"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=12314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=12314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=12314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}