Files and folders

Check disk space and find what is using it

See how full each drive is, then find the folders taking up the most room.

  1. See how full each drive is
    Terminal
    df -h

    Look at the Use% column for the line ending in / or /System/Volumes/Data.

  2. Find the biggest folders in your home folder
    Terminal
    du -sh ~/* 2>/dev/null | sort -h | tail -10

    The biggest ones are at the bottom. Can take a minute on a big disk.

  3. Look inside one of them
    Terminal
    du -sh ~/Library/* 2>/dev/null | sort -h | tail -10

    Swap ~/Library for any folder from the last step and keep drilling down.

  1. See how full each drive is
    Terminal · Ubuntu / Debian
    df -h

    Look at the Use% column for the line mounted on /.

  2. Find the biggest folders in your home folder
    Terminal · Ubuntu / Debian
    du -h --max-depth=1 ~ 2>/dev/null | sort -h | tail -10

    The biggest ones are at the bottom. The last line is the total.

  3. Find the biggest folders on the whole systemNeeds sudo
    Terminal · Ubuntu / Debian
    sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -10

    -x stays on this one drive. Then run the same command on the biggest folder to drill down.

  1. See how full each drive is
    PowerShell
    Get-PSDrive -PSProvider FileSystem

    Used and Free are shown in GB for each drive letter.

  2. Go to the folder you want to check
    PowerShell
    cd $HOME
  3. Find the biggest folders in it
    PowerShell
    Get-ChildItem -Directory -Force | ForEach-Object {
      $size = (Get-ChildItem $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum
      [pscustomobject]@{ Folder = $_.Name; GB = [math]::Round($size / 1GB, 2) }
    } | Sort-Object GB -Descending | Select-Object -First 10

    The biggest ones are at the top. Can take a minute on a big disk.