{"id":1016,"date":"2018-05-21T11:55:35","date_gmt":"2018-05-21T11:55:35","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1016"},"modified":"2019-04-27T11:50:52","modified_gmt":"2019-04-27T06:20:52","slug":"how-to-check-disk-usage-using-df-commands","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-check-disk-usage-using-df-commands\/","title":{"rendered":"How to check disk usage using df commands"},"content":{"rendered":"<p><strong>Description&nbsp;<\/strong><\/p>\n<p>The \u2018df\u2018 command stand for \u201cdisk filesystem\u201c, it is used to get full summary of available and used disk space usage of file system on Linux system.<\/p>\n<p>Using \u2018-h\u2018 parameter with (df -h) will shows the file system disk space statistics in \u201chuman readable\u201d format, means it gives the details in bytes, mega bytes and gigabyte.<\/p>\n<p>This article explain a way to get the full information of Linux disk space usage with the help of \u2018df\u2018 command with their practical examples.<\/p>\n<p>So, you could better understand the usage of df command in Linux.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1. Check File System Disk Space Usage df<\/strong><\/p>\n<p>The \u201c<strong>df<\/strong>\u201d command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df\nFilesystem 1K-blocks Used Available Use% Mounted on\n\/dev\/xvda1 41153856 2362628 36677692 7% \/\ndevtmpfs 486288 0 486288 0% \/dev\ntmpfs 506216 0 506216 0% \/dev\/shm\ntmpfs 506216 57232 448984 12% \/run\ntmpfs 506216 0 506216 0% \/sys\/fs\/cgroup\ntmpfs 101244 0 101244 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>2. Display Information of all File System Disk Space Usage df -a<\/strong><\/p>\n<p>This displays information of dummy file systems along with all the file system disk usage and their memory utilization.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -a\nFilesystem 1K-blocks Used Available Use% Mounted on\nrootfs - - - - \/\nsysfs 0 0 0 - \/sys\nproc 0 0 0 - \/proc\ndevtmpfs 486288 0 486288 0% \/dev\nsecurityfs 0 0 0 - \/sys\/kernel\/security\ntmpfs 506216 0 506216 0% \/dev\/shm\ndevpts 0 0 0 - \/dev\/pts\ntmpfs 506216 57232 448984 12% \/run\ntmpfs 506216 0 506216 0% \/sys\/fs\/cgroup\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/systemd\npstore 0 0 0 - \/sys\/fs\/pstore\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/memory\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/freezer\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/pids\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/cpu,cpuacct\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/devices\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/blkio\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/net_cls,net_prio\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/hugetlb\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/perf_event\ncgroup 0 0 0 - \/sys\/fs\/cgroup\/cpuset\nconfigfs 0 0 0 - \/sys\/kernel\/config\n\/dev\/xvda1 41153856 2362628 36677692 7% \/\nselinuxfs 0 0 0 - \/sys\/fs\/selinux\nsystemd-1 - - - - \/proc\/sys\/fs\/binfmt_misc\ndebugfs 0 0 0 - \/sys\/kernel\/debug\nmqueue 0 0 0 - \/dev\/mqueue\nhugetlbfs 0 0 0 - \/dev\/hugepages\nbinfmt_misc 0 0 0 - \/proc\/sys\/fs\/binfmt_misc\ntmpfs 101244 0 101244 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>3. Show Disk Space Usage in Human Readable Format df -h<\/strong><\/p>\n<p>Have you noticed that above commands displays information in bytes, which is not readable yet all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. as it makes very easy to understand and remember.<\/p>\n<p>The df command provides an option to display sizes in Human Readable formats by using \u2018-h\u2019 (prints the results in human readable format (e.g., 1K 2M 3G)).<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -h\nFilesystem Size Used Avail Use% Mounted on\n\/dev\/xvda1 40G 2.3G 35G 7% \/\ndevtmpfs 475M 0 475M 0% \/dev\ntmpfs 495M 0 495M 0% \/dev\/shm\ntmpfs 495M 56M 439M 12% \/run\ntmpfs 495M 0 495M 0% \/sys\/fs\/cgroup\ntmpfs 99M 0 99M 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>4. Display Information of \/home File System df -hT \/home<\/strong><\/p>\n<p>To see the information of only device \/home file system in human readable format use the following command.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -hT \/home\nFilesystem Type Size Used Avail Use% Mounted on\n\/dev\/xvda1 ext4 40G 2.3G 35G 7% \/<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>5. Display Information of File System in Bytes df -k<\/strong><\/p>\n<p>To display all file system information and usage in 1024-byte blocks, use the option \u2018-k\u2018 (e.g. \u2013block-size=1K) as follows.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -k\nFilesystem 1K-blocks Used Available Use% Mounted on\n\/dev\/xvda1 41153856 2362636 36677684 7% \/\ndevtmpfs 486288 0 486288 0% \/dev\ntmpfs 506216 0 506216 0% \/dev\/shm\ntmpfs 506216 57232 448984 12% \/run\ntmpfs 506216 0 506216 0% \/sys\/fs\/cgroup\ntmpfs 101244 0 101244 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>6. Display Information of File System in MB<\/strong><\/p>\n<p>To display information of all file system usage in MB (Mega Byte) use the option as \u2018<strong>-m<\/strong>\u2018.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -m\nFilesystem 1M-blocks Used Available Use% Mounted on\n\/dev\/xvda1 40190 2308 35819 7% \/\ndevtmpfs 475 0 475 0% \/dev\ntmpfs 495 0 495 0% \/dev\/shm\ntmpfs 495 56 439 12% \/run\ntmpfs 495 0 495 0% \/sys\/fs\/cgroup\ntmpfs 99 0 99 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>7. Display Information of File System in GB<\/strong><\/p>\n<p>To display information of all file system statistics in GB (Gigabyte) use the option as \u2018<strong>df -h<\/strong>\u2018.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -h\nFilesystem Size Used Avail Use% Mounted on\n\/dev\/xvda1 40G 2.3G 35G 7% \/\ndevtmpfs 475M 0 475M 0% \/dev\ntmpfs 495M 0 495M 0% \/dev\/shm\ntmpfs 495M 56M 439M 12% \/run\ntmpfs 495M 0 495M 0% \/sys\/fs\/cgroup\ntmpfs 99M 0 99M 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>8. Display File System Inodes<\/strong><\/p>\n<p>Using \u2018<strong>-i<\/strong>\u2018 switch will display the information of number of used inodes and their percentage for the file system.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -i\nFilesystem Inodes IUsed IFree IUse% Mounted on\n\/dev\/xvda1 2621440 57713 2563727 3% \/\ndevtmpfs 121572 287 121285 1% \/dev\ntmpfs 126554 1 126553 1% \/dev\/shm\ntmpfs 126554 373 126181 1% \/run\ntmpfs 126554 16 126538 1% \/sys\/fs\/cgroup\ntmpfs 126554 1 126553 1% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>9. Display File System Type<\/strong><\/p>\n<p>If you notice all the above commands output, you will see there is no file system type mentioned in the results.<\/p>\n<p>To check the file system type of your system use the option \u2018T\u2018. It will display file system type along with other information.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -T\nFilesystem Type 1K-blocks Used Available Use% Mounted on\n\/dev\/xvda1 ext4 41153856 2362648 36677672 7% \/\ndevtmpfs devtmpfs 486288 0 486288 0% \/dev\ntmpfs tmpfs 506216 0 506216 0% \/dev\/shm\ntmpfs tmpfs 506216 57232 448984 12% \/run\ntmpfs tmpfs 506216 0 506216 0% \/sys\/fs\/cgroup\ntmpfs tmpfs 101244 0 101244 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>10. Include Certain File System Type<\/strong><\/p>\n<p>If you want to display certain file system type use the \u2018-t\u2018 option.<\/p>\n<p>For example, the following command will only display ext3 file system.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df -t ext3\nFilesystem 1K-blocks Used Available Use% Mounted on\n\/dev\/cciss\/c0d0p2 78361192 23190072 51126356 32% \/\n\/dev\/cciss\/c0d0p5 24797380 22273432 1243972 95% \/home\n\/dev\/cciss\/c0d0p3 29753588 25503792 2713984 91% \/data\n\/dev\/cciss\/c0d0p1 295561 21531 258770 8% \/boot<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>11. Exclude Certain File System Type<\/strong><\/p>\n<p>If you want to display file system type that doesn\u2019t belongs to ext3 type use the option as \u2018-x\u2018.<\/p>\n<p>For example, the following command will only display other file systems types other than ext3.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@mvps ~]# df -x ext3\nFilesystem 1K-blocks Used Available Use% Mounted on\n\/dev\/xvda1 41153856 2362648 36677672 7% \/\ndevtmpfs 486288 0 486288 0% \/dev\ntmpfs 506216 0 506216 0% \/dev\/shm\ntmpfs 506216 57232 448984 12% \/run\ntmpfs 506216 0 506216 0% \/sys\/fs\/cgroup\ntmpfs 101244 0 101244 0% \/run\/user\/0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>12. Display Information of df Command.<\/strong><\/p>\n<p>Using \u2018\u2013help\u2018 switch will display a list of available option that are used with df command.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# df --help\nUsage: df [OPTION]... [FILE]...\nShow information about the file system on which each FILE resides,\nor all file systems by default.\nMandatory arguments to long options are mandatory for short options too.\n-a, --all include dummy file systems\n-B, --block-size=SIZE use SIZE-byte blocks\n-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n-H, --si likewise, but use powers of 1000 not 1024\n-i, --inodes list inode information instead of block usage\n-k like --block-size=1K\n-l, --local limit listing to local file systems\n--no-sync do not invoke sync before getting usage info (default)\n-P, --portability use the POSIX output format\n--sync invoke sync before getting usage info\n-t, --type=TYPE limit listing to file systems of type TYPE\n-T, --print-type print file system type\n-x, --exclude-type=TYPE limit listing to file systems not of type TYPE\n-v (ignored)\n--help display this help and exit\n--version output version information and exit\nSIZE may be (or may be an integer optionally followed by) one of following:\nkB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\nReport bugs to &lt;bug-coreutils@gnu.org&gt;.<\/pre>\n<p>&nbsp;<\/p>\n<p>We hope you\u2019ve found this useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description&nbsp; The \u2018df\u2018 command stand for \u201cdisk filesystem\u201c, it is used to get full summary of available and used disk space usage of file system on Linux system. Using \u2018-h\u2018 parameter with (df -h) will shows the file system disk space statistics in \u201chuman readable\u201d format, means it gives the details in bytes, mega bytes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1303,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1016","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1016"}],"version-history":[{"count":2,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1016\/revisions"}],"predecessor-version":[{"id":1551,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1016\/revisions\/1551"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1303"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}