Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

How to check disk space usage on Ubuntu

Posted on September 21, 2024

How to check what is taking up all the disk space on Ubuntu

Here are a few things you can try:

Note: Depending on the size, these commands can take a while to complete.

1) Run df command:

df -h /

2) Run du command:

du -hs /

If it takes a long time, you can try checking sub directories instead to narrow down the issue:

du -hs /var/log
du -hs /var/www
du -hs /opt

sudo du -h --max-depth=1 / | sort -hr | head -n 10
sudo du -h --max-depth=1 /var/lib | sort -hr | head -n 10

3) Run ncdu command:

apt update
apt install ncdu
ncdu /

4) If docker is taking up the space:

Check with du and sort it:

sudo du -h --max-depth=1 /var/lib/docker | sort -hr | head -n 10
sudo du -h --max-depth=1 /var/lib/docker/containers/ | sort -hr | head -n 10

Docker Disk Space Commands Cheat Sheet:

CommandDescription
docker system dfShow Docker disk usage
docker system pruneClean up Docker system
docker container pruneRemove unused containers
docker image pruneRemove unused images
docker volume pruneRemove unused volumes
docker network pruneRemove unused networks
docker builder pruneRemove unused build cache
Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme