# Disk Usage — Linux Command Line Fundamentals

Source: https://www.skillbyai.com/en/linux/linux-disk-usage

> Find where disk space goes with df for filesystems and du for directories sorted by size.

## df — filesystem space

`df -h` shows free/used space per mounted filesystem, in human-readable units.

```bash
df -h
```

Output:

```
Filesystem  Size  Used Avail Use% Mounted on
/dev/sda1    50G   32G   16G  67% /
```

## du — directory size

`du -sh dir` shows a directory's total size; sort the biggest offenders with `du -sh * | sort -h`.

```bash
du -sh /var/log
du -sh * | sort -h
```

Output:

```
128M    /var/log
```
