DEV Community

Mohammed Chami
Mohammed Chami

Posted on

How to Check Disk Space in Linux (Terminal & GUI Methods)

Managing disk space is essential for keeping your Linux system running smoothly. Whether you prefer the command line or graphical tools, here’s a straightforward guide to checking your free and used storage.


1. Quick Terminal Commands

Check Total Disk Usage (df)

The simplest way to see disk space across all partitions:

df -h
Enter fullscreen mode Exit fullscreen mode
  • -h → Shows sizes in GB/MB (human-readable).
  • Key columns:
    • Avail → Free space.
    • Use% → Percentage used.

Example Output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  200G   50G  150G  25% /
Enter fullscreen mode Exit fullscreen mode

Check Folder Sizes (du)

To see how much space a specific folder (like /home) is using:

du -sh ~/
Enter fullscreen mode Exit fullscreen mode
  • -s → Summary (total size).
  • -h → Human-readable format.

Interactive Disk Usage Analyzer (ncdu)

For a more detailed breakdown, install ncdu:

sudo pacman -S ncdu
ncdu /
Enter fullscreen mode Exit fullscreen mode
  • Navigate with arrow keys.
  • Sort by size (press n for name, s for size).
  • Delete files directly (press d).

2. Graphical Tools (For Desktop Users)

GNOME Disks (Default in GNOME)

  1. Open "Disks" from the app menu.
  2. Select your disk → View partition usage in the graph.

KDE Partition Manager (For KDE Plasma)

  1. Install it:
   sudo pacman -S partitionmanager
Enter fullscreen mode Exit fullscreen mode
  1. Open Partition Manager → Check disk space visually.

File Manager (Thunar/Dolphin/Nautilus)

  • Open your file manager (e.g., Thunar in Xfce).
  • Right-click a drive → Properties → See free space.

3. Advanced: Finding Large Files

To locate large files (>100MB) in your home directory:

find ~/ -type f -size +100M -exec ls -lh {} \;
Enter fullscreen mode Exit fullscreen mode
  • -type f → Files only (excludes folders).
  • -size +100M → Filters files larger than 100MB.

Summary: Which Method Should You Use?

Use Case Recommended Tool Command
Quick overview of all disks df -h df -h
Check a folder’s size du du -sh ~/
Interactive disk analysis ncdu ncdu /
GUI (GNOME) Disks app Open from Applications
GUI (KDE) Partition Manager sudo pacman -S partitionmanager
Find large files find find ~/ -size +100M

thank you :>|

Top comments (0)