Check the capacity of the Linux server. (Df command, du command)

less than 1 minute read

I also search for this every time, so make a note of it.

【df】
List the maximum capacity / used capacity / free space for each partition.

  • -h: Displayed in units that are easy for humans to understand

df


df -h
# Filesystem      Size  Used Avail Use% Mounted on
# overlay          59G  2.7G   53G   5% /
# tmpfs            64M     0   64M   0% /dev
# tmpfs          1000M     0 1000M   0% /sys/fs/cgroup
# /dev/sda1        59G  2.7G   53G   5% /etc/hosts
# shm              64M     0   64M   0% /dev/shm
# tmpfs          1000M     0 1000M   0% /proc/acpi
# tmpfs          1000M     0 1000M   0% /sys/firmware

【du】
Display the size of directories and files.

  • -h: Displayed in units that are easy for humans to understand
  • -s: Show only total

du


du -hs /etc
# 1.5M	/etc

du -h /etc
# 4.0K	/etc/opt
# 12K	/etc/logrotate.d
# 12K	/etc/ld.so.conf.d
# 8.0K	/etc/terminfo
# 16K	/etc/skel
# ……

Remarks

This article is a migration article from the blog “Technical Notes for Chores Engineers”. The previous blog will be deleted.