How To Check Disk Space

Every operating system offers a large number of choices to explore and manage disks, but there are cases where it is handy to access just important information such disk space left without any GUI via terminal or command prompt.

From command prompt of Windows:

PS C:\Users\systemteam> wmic logicaldisk get volumename,size,freespace,caption,filesystem,drivetype,description
Caption  Description         DriveType  FileSystem  FreeSpace      Size           VolumeName
C:       Local Fixed Disk    3          NTFS        174844219392   249531723776   OS
D:       Local Fixed Disk    3          NTFS        764490784768   1000202039296  Data
E:       CD-ROM Disc         5

With PowerShell

PS C:\Users\systemteam> Get-Volume

DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- ------------ -------------- --------- ------------ ----------------- -------------      ----
D           Data         NTFS           Fixed     Healthy      OK                    711.99 GB 931.51 GB
                         NTFS           Fixed     Healthy      OK                       119 MB    500 MB
C           OS           NTFS           Fixed     Healthy      OK                    162.84 GB 232.39 GB
E                        Unknown        CD-ROM    Healthy      Unknown                     0 B       0 B

Interested in shared folders? Try Get-PSDrive cmd-let!

With Bash

boss@scriptingbox:~# df -h --total
Filesystem                   Size  Used Avail Use% Mounted on
udev                         972M     0  972M   0% /dev
tmpfs                        199M   21M  178M  11% /run
/dev/mapper/ubuntu--vg-root  123G  1.8G  115G   2% /
tmpfs                        992M     0  992M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        992M     0  992M   0% /sys/fs/cgroup
/dev/sda1                    472M  106M  343M  24% /boot
tmpfs                        199M     0  199M   0% /run/user/0
total                        127G  1.9G  118G   2% -

Another result from BaSH on Windows (Windows Subsystem for Linux)

boss@scriptingbox:~# df -h --total
Filesystem      Size  Used Avail Use% Mounted on
rootfs          233G   70G  163G  30% /
data            233G   70G  163G  30% /data
cache           233G   70G  163G  30% /cache
mnt             233G   70G  163G  30% /mnt
none            233G   70G  163G  30% /dev
none            233G   70G  163G  30% /run
none            233G   70G  163G  30% /run/lock
none            233G   70G  163G  30% /run/shm
none            233G   70G  163G  30% /run/user
C:              233G   70G  163G  30% /mnt/c
D:              932G  220G  712G  24% /mnt/d
root            233G   70G  163G  30% /root
home            233G   70G  163G  30% /home
total           3.7T  1.1T  2.7T  29% -

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.