How to check disk space in Ubuntu terminal? Here is the Linux command to get disk space in gb – on Linux check free disk space in gb and on Linux check total disk space in gb.
Use df Command to Check Total Disk Space In Linux
The “df” command is for “disk filesystem” and is a great tool to know about the disk space usage on Linux Systems. The df command displays the amount of disk space available on the file system. If no file name is given, the space available on all currently mounted file systems is shown.
The simplest df command is by itself. Without any command parameters. When executed the df command displays the information about the file system disk space usage. It shows the device name, total blocks, total disk space, used disk space, free disk space and mount points.
df
Using the df command with -a or –all it shows dummy file systems information along with all the basic file system disk usage info:
Linux Command To Check Hard Disk Size in GB
As the disk space is shown in 1K blocks by default, users can use “-h” command parameter to show the file system disk space usage data in “human readable” format.
df -h
-h is human readable format. It appends a size letter to each size, such as ‘M’ for mebibytes. Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes. This option is equivalent to ‘–block-size=human-readable’.
Another great option to use is df –output command. It shows every information and detail regarding the disk space. It can display:
- ‘source’ – The source of the mount point, usually a device.
- ‘fstype’ – File system type.
- ‘itotal’ – Total number of inodes.
- ‘iused’ – Number of used inodes.
- ‘iavail’ – Number of available inodes.
- ‘ipcent’ – Percentage of IUSED divided by ITOTAL.
- ‘size’ – Total number of blocks.
- ‘used’ – Number of used blocks.
- ‘avail’ – Number of available blocks.
- ‘pcent’ – Percentage of USED divided by SIZE.
- ‘file’ – The file name if specified on the command line.
- ‘target’ – The mount point.
Command to Display the Total Disk Usage of the Current Directory
‘du’ reports the amount of disk space used by the set of specified files and for each subdirectory (of directory arguments).
With no arguments, ‘du’ reports the disk space for the current directory. Normally the disk space is printed in units of 1024 bytes, but this can be overridden.