You can view the used disk space on a Linux server using the df
command.
The df
command provides information about the file system disk space usage, including the amount of used and available disk space for each file system on the server.
To view the used disk space on a Linux server using the df
command, follow these steps:
Open a terminal window on the Linux server.
Type the following command and press Enter:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 251G 7.6G 231G 4% /
tmpfs 13G 0 13G 0% /mnt/wsl
tools 233G 219G 15G 94% /init
none 13G 0 13G 0% /dev
none 13G 16K 13G 1% /run
none 13G 0 13G 0% /run/lock
none 13G 0 13G 0% /run/shm
none 13G 0 13G 0% /run/user
tmpfs 13G 0 13G 0% /sys/fs/cgroup
drivers 233G 219G 15G 94% /usr/lib/wsl/drivers
lib 233G 219G 15G 94% /usr/lib/wsl/lib
C:\ 233G 219G 15G 94% /mnt/c
D:\ 465G 445G 20G 96% /mnt/d
E:\ 932G 51G 881G 6% /mnt/e
The -h
option displays the disk space usage in a human-readable format, using units like "GB" or "MB" instead of raw bytes.
df
command will display a list of all the file systems on the server, along with their total size, used space, available space, and mount point. Look for the file system you are interested in to see its disk usage.If you want to view the disk usage for a specific directory, you can use the du
command. For example, to view the disk usage for the current directory and all its subdirectories, you can use the following command:
The -h
option is again used to display the disk usage in a human-readable format.