Check Disk Usage and Storage
Find out whether a disk is full, what partitions exist, and which folders are using the space. df answers “is the disk full”, lsblk answers “what disks and partitions exist”, du answers “which folders use the space”, and ncdu lets you browse usage interactively.
Quick reference
Section titled “Quick reference”# is the disk fulldf -h
# disks, partitions, filesystem types, and mount pointslsblk -f
# biggest folders in home, largest firstdu -h --max-depth=1 ~ | sort -hr
# total size of one folderdu -sh "$HOME/projects"
# interactive disk usage browserncdu ~Check disk and partition usage
Section titled “Check disk and partition usage”df (disk free) lists mounted filesystems with size, used, available, and percent
used. The key row is the one mounted on /, the root filesystem: if it is near
full the system disk is near full. As a rule of thumb, investigate when / is
above about 80 percent.
df -hFilesystem Size Used Avail Use% Mounted on/dev/nvme0n1p2 500G 180G 320G 37% //dev/nvme0n1p1 1.0G 300M 700M 30% /bootSee disks and partitions
Section titled “See disks and partitions”lsblk (list block devices) shows disks, SSDs, NVMe and USB drives, and their
partitions as a tree. Add -f to also show filesystem type, label, UUID, and
mount point, which is what you usually want.
lsblk -fNAME FSTYPE FSVER LABEL UUID MOUNTPOINTnvme0n1├─nvme0n1p1 vfat FAT32 XXXX-XXXX /boot└─nvme0n1p2 ext4 1.0 xxxxxxxx-... /Use this to see which partition is root (/), which is boot (/boot), and the
filesystem type of each.
| Filesystem | Typical role |
|---|---|
| ext4 | Common Linux root filesystem |
| btrfs | Modern Linux filesystem with snapshots and subvolumes |
| vfat | EFI boot partition |
| swap | Swap partition or area |
Find which folders use space
Section titled “Find which folders use space”du (disk usage) reports folder sizes. --max-depth=1 keeps it to one level so
you see the immediate subfolders, not every nested file. Pipe to sort -hr to
order largest first (-h sorts human-readable sizes correctly, -r reverses).
# subfolders of the current directorydu -h --max-depth=1
# subfolders of home, largest firstdu -h --max-depth=1 ~ | sort -hr30G /home/user20G /home/user/projects3.5G /home/user/downloads1.2G /home/user/.cache500M /home/user/.configWhen you only care about one folder, -s summarizes it to a single total.
du -sh "$HOME/projects"Browse usage interactively with ncdu
Section titled “Browse usage interactively with ncdu”ncdu is an interactive disk usage browser. It scans a directory once, then lets you move into the largest folders to find what is taking space, which is usually faster than repeated du calls.
# Archsudo pacman -S ncdu
# Ubuntu/Debiansudo apt install ncdu
ncdu ~Inside ncdu: arrow keys move, Enter opens a folder, Backspace goes back, d
deletes the selected entry, q quits. Be careful with d, it deletes
immediately.
Typical workflow
Section titled “Typical workflow”df -hto check whether/is near full.lsblk -fto confirm the disk and partition layout.du -h --max-depth=1 ~ | sort -hrto find the largest home folders.- Repeat du on a large folder, for example
du -h --max-depth=1 "$HOME/projects" | sort -hr. ncdu ~when manual scanning is not enough.
Mental model
Section titled “Mental model”| Command | Answers |
|---|---|
| df | Is my disk or partition full? |
| lsblk | What disks and partitions do I have? |
| lsblk -f | What filesystem and mount point does each partition have? |
| du | Which folders are using the space? |
| ncdu | Let me browse storage usage interactively. |