How to check disk space in ubuntu 22. 04

How to Check Disk Space in Ubuntu 22.04

Monitoring disk usage is an important system administration task to avoid running out of storage. This comprehensive guide covers multiple methods and commands to check disk space in Ubuntu 22.04.

Why Check Disk Space in Linux?

There are several key reasons to regularly monitor disk utilization on Linux servers and workstations:

  • Avoid performance slowdowns when disks fill up
  • Prevent system outages or corruption from 100% disk usage
  • Identify trends to plan storage upgrades before hitting limits
  • Ensure critical data is not lost due to inadequate free space
  • Detect disk errors early through usage inconsistencies
  • Sponsored
  • Determine what is consuming excess space for clean up
  • Optimize file system layout across available disks

Checking disk space should be part of regular Linux server maintenance. Monitoring tools can also automatically alert when usage exceeds thresholds.

Read: How to check memory usage on Ubuntu 22.04

Ways to Check Disk Space in Linux

There are several Linux commands and utilities that provide visibility into disk usage:

See also  Ubuntu 23.04 (Lunar Lobster) reaches End of Life on January 25, 2024

df Command

The df (disk free) command displays disk space details for file systems.

How to check disk space in ubuntu 22. 04 1

Linux check disk space

To show all mounted filesystems:

df -h

How to check disk space in ubuntu 22. 04 2

This prints filesystem, 1K-block size, used space, available space, capacity, and mount point. The -h flag prints human readable format in GB, MB, etc.

Read: How to fix high memory usage in Linux

To show just a specific filesystem:

df -h /home

How to check disk space in ubuntu 22. 04 3

du Command

The du (disk usage) command reports space occupied by directories and files.

Show disk usage summary for current directory:

du -sh

How to check disk space in ubuntu 22. 04 4

The -s flag prints total rather than individual file sizes. The -h displays human readable format.

Check disk usage for a specific folder:

du -sh /var/log

How to check disk space in ubuntu 22. 04 5

Using du -sh * prints size of all directories and files in current folder.

Sponsored

How to check disk space in ubuntu 22. 04 6

Read: Moving the Home folder to another partition in Ubuntu

fdisk

The fdisk command shows disk partition information including size.

List partitions on first disk drive:

fdisk -l /dev/sda

How to check disk space in ubuntu 22. 04 7

This prints details like partition size, type, and mount point for each partition on that disk.

ncdu

The ncdu tool scans directories and provides an interactive ncurses-based interface to browse disk usage.

To scan current directory:

ncdu

How to check disk space in ubuntu 22. 04 8

How to check disk space in ubuntu 22. 04 9

ncdu

How to check disk space in ubuntu 22. 04 10

It allows drill-down analysis into subfolders and sorting by size to identify what is consuming excess space.

Graphical Disk Usage Tools

GUI tools provide visual representations of disk usage.

Baobab

Baobab is a Gnome disk usage analyzer. To install it run:

How to check disk space in ubuntu 22. 04 11

To launch:

baobab

How to check disk space in ubuntu 22. 04 12

It provides a graphical tree map of folders and enables drilling down into them to identify and clean up space.

How to check disk space in ubuntu 22. 04 13

 

The post How to Check Disk Space in Ubuntu 22.04 appeared first on net2.

Leave a Comment

Only people in my network can comment.