Understanding the Basic df Command
As a system administrator, your first task is to get an overview of the disk space usage on your web server. The df
command without any options provides a quick snapshot of all mounted filesystems.
First, let's navigate to the project directory:
cd ~/project
Now, let's run the basic df
command:
df
Tips: Due to the dynamic changes in virtual machine storage, the output of the df command may be inconsistent, and this issue can be ignored.
You should see output similar to this:
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 20971520 1314600 19656920 7% /
tmpfs 65536 0 65536 0% /dev
tmpfs 4068320 0 4068320 0% /sys/fs/cgroup
shm 65536 0 65536 0% /dev/shm
/dev/vdb 104806400 17442788 87363612 17% /etc/hosts
tmpfs 102400 51200 51200 50% /mnt/ramdisk
Let's break down this output:
Filesystem
: This column shows the name of the device or partition.
1K-blocks
: This shows the total size of the filesystem in 1-kilobyte blocks.
Used
: This indicates how many 1K-blocks are used.
Available
: This shows how many 1K-blocks are available.
Use%
: This shows the percentage of the filesystem that is used.
Mounted on
: This shows where in the directory tree the filesystem is mounted.
Notice the overlay
filesystem, which is commonly used in containerized environments. The /dev/vdb
device is likely a virtual disk, and we can see a tmpfs
filesystem mounted at /mnt/ramdisk
, which is a RAM-based filesystem.