Master Linux Disk Space: Essential Commands to Analyze and Free Up Storage
This guide introduces key Linux commands such as ls, stat, df, du, and fdisk, explains their most useful options, shows how to interpret their output, and provides practical tips for analyzing disk usage and safely reclaiming space on servers.
ls -al
The ls -al command lists all files and directories in the current folder with detailed information; adding the -h flag makes sizes human‑readable, helping you spot large items at a glance.
stat
The stat command displays comprehensive metadata for a specified file or directory, including size, block count, inode number, and timestamps for creation, access, and modification.
df
The df (disk free) command reports available space on mounted filesystems. Common options include: df -h: display sizes in a human‑readable format. df -a: show all filesystems, even those with zero available space. df -T: include the filesystem type (e.g., ext4, xfs, btrfs). df -i: list used and free inodes.
For a graphical overview, the disks utility visualizes the same information in a user‑friendly window.
du
The du (disk usage) command reports the space consumed by files and directories. Frequently used forms are: du -h: show sizes in a human‑readable format for all directories and sub‑directories. du -a: list disk usage for every file in the current directory. du -s: display only the total size of the specified directory.
fdisk -l
The fdisk utility manages partition tables; the -l option lists partition details for all detected disks without modifying them. Use other options with extreme caution, as they can irreversibly alter partitions.
Summary
By mastering these commands— ls -al, stat, df, du, and fdisk -l —you can quickly assess disk consumption, identify large or unnecessary files, and safely reclaim space on Linux servers.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
