via: http://www.tecmint.com/how-to-check-disk-space-in-linux/
On the internet you will find plenty of tools for checking disk space utilization in Linux. However, Linux has a strong built in utility called ‘df‘. The ‘df‘ command stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on Linux system.
Using ‘-h‘ parameter with (df -h) will shows the file system disk space statistics in “human readable” format, means it gives the details in bytes, mega bytes and gigabyte.
This article explain a way to get the full information of Linux disk space usage with the help of ‘df‘ command with their practical examples. So, you could better understand the usage of df command in Linux.
1. Check File System Disk Space Usage
The “df” 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.
[root@tecmint ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23185840 51130588 32% / /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm
2. Display Information of all File System Disk Space Usage
The same as above, but it also displays information of dummy file systems along with all the file system disk usage and their memory utilization.
[root@tecmint ~]# df -a Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23186116 51130312 32% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm none 0 0 0 - /proc/sys/fs/binfmt_misc sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
3. Show Disk Space Usage in Human Readable Format
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.
The df command provides an option to display sizes in Human Readable formats by using ‘-h’ (prints the results in human readable format (e.g., 1K 2M 3G)).
[root@tecmint ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/cciss/c0d0p2 75G 23G 49G 32% / /dev/cciss/c0d0p5 24G 22G 1.2G 95% /home /dev/cciss/c0d0p3 29G 25G 2.6G 91% /data /dev/cciss/c0d0p1 289M 22M 253M 8% /boot tmpfs 252M 0 252M 0% /dev/shm
4. Display Information of /home File System
To see the information of only device /home file system in human readable format use the following command.
[root@tecmint ~]# df -hT /home Filesystem Type Size Used Avail Use% Mounted on /dev/cciss/c0d0p5 ext3 24G 22G 1.2G 95% /home
5. Display Information of File System in Bytes
To display all file system information and usage in 1024-byte blocks, use the option ‘-k‘ (e.g. –block-size=1K) as follows.
[root@tecmint ~]# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23187212 51129216 32% / /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm
6. Display Information of File System in MB
To display information of all file system usage in MB (Mega Byte) use the option as ‘-m‘.
[root@tecmint ~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 76525 22644 49931 32% / /dev/cciss/c0d0p5 24217 21752 1215 95% /home /dev/cciss/c0d0p3 29057 24907 2651 91% /data /dev/cciss/c0d0p1 289 22 253 8% /boot tmpfs 252 0 252 0% /dev/shm
7. Display Information of File System in GB
To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h‘.
[root@tecmint ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/cciss/c0d0p2 75G 23G 49G 32% / /dev/cciss/c0d0p5 24G 22G 1.2G 95% /home /dev/cciss/c0d0p3 29G 25G 2.6G 91% /data /dev/cciss/c0d0p1 289M 22M 253M 8% /boot tmpfs 252M 0 252M 0% /dev/shm
8. Display File System Inodes
Using ‘-i‘ switch will display the information of number of used inodes and their percentage for the file system.
[root@tecmint ~]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/cciss/c0d0p2 20230848 133143 20097705 1% / /dev/cciss/c0d0p5 6403712 798613 5605099 13% /home /dev/cciss/c0d0p3 7685440 1388241 6297199 19% /data /dev/cciss/c0d0p1 76304 40 76264 1% /boot tmpfs 64369 1 64368 1% /dev/shm
9. Display File System Type
If you notice all the above commands output, you will see there is no file system type mentioned in the results. To check the file system type of your system use the option ‘T‘. It will display file system type along with other information.
[root@tecmint ~]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 ext3 78361192 23188812 51127616 32% / /dev/cciss/c0d0p5 ext3 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 ext3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 ext3 295561 21531 258770 8% /boot tmpfs tmpfs 257476 0 257476 0% /dev/shm
10. Include Certain File System Type
If you want to display certain file system type use the ‘-t‘ option. For example, the following command will only display ext3 file system.
[root@tecmint ~]# df -t ext3 Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23190072 51126356 32% / /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot
11. Exclude Certain File System Type
If you want to display file system type that doesn’t belongs to ext3 type use the option as ‘-x‘. For example, the following command will only display other file systems types other than ext3.
[root@tecmint ~]# df -x ext3 Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 257476 0 257476 0% /dev/shm
12. Display Information of df Command.
Using ‘–help‘ switch will display a list of available option that are used with df command.
[root@tecmint ~]# df --help Usage: df [OPTION]... [FILE]... Show information about the file system on which each FILE resides, or all file systems by default. Mandatory arguments to long options are mandatory for short options too. -a, --all include dummy file systems -B, --block-size=SIZE use SIZE-byte blocks -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) -H, --si likewise, but use powers of 1000 not 1024 -i, --inodes list inode information instead of block usage -k like --block-size=1K -l, --local limit listing to local file systems --no-sync do not invoke sync before getting usage info (default) -P, --portability use the POSIX output format --sync invoke sync before getting usage info -t, --type=TYPE limit listing to file systems of type TYPE -T, --print-type print file system type -x, --exclude-type=TYPE limit listing to file systems not of type TYPE -v (ignored) --help display this help and exit --version output version information and exit SIZE may be (or may be an integer optionally followed by) one of following: kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. Report bugs to <bug-coreutils@gnu.org>.
相关推荐
PRENTICE_HALL-A_Practical_Guide_To_Linux_Commands_Editors_And_Shell_Programming
书名为《Linux Commands and Shell Programming 2nd》,即第二版《Linux命令及Shell编程实用指南》,作者为Mark G. Sobell。这本书被描述为Linux命令行操作和Shell编程的必备读物,其内容通俗易懂,翔实可靠,专注于...
_Easy_to_manage_linux_commands_方便简单的管理linux命令__lflxp-cmd
Linux英文原版图书系列].PRENTICE_HALL-A_Practical_Guide_To_Linux_Commands_Editors_And_Shell_Programming.chm
_Impressive_Linux_commands_cheat_sheet_CLI_writt_pls
linux_命令实践总结_commands-linux
Quectel_EC20_AT_Commands_Manual_V1.0.pdfQuectel_EC20_AT_Commands_Manual_V1.0.pdf
linux(ubuntu系统)常用命令汇总_linux_commands
[Linux英文原版图书系列].PRENTICE_HALL-A_Practical_Guide_To_Linux_Commands_Editors_And_Shell_Program [Linux英文原版图书系列].PRENTICE_HALL-Building_Applications_With_The_Linux_Standard_Base [Linux英文...
Quectel_EC20_AT_Commands_Manual_V1.3 版本,相对以前版本有所更新!
《Quectel GNSS SDK Commands Manual V1.4》是针对Quectel公司LC86L GNSS模块的一份详细技术文档,旨在帮助开发者理解和利用Quectel GNSS软件开发工具包(SDK)进行定位应用的开发。这篇文档将深入探讨该SDK的主要...
文档标题为《Quectel_EC20_R2.1_AT_Commands_Manual_V1.0.pdf》,文档描述为移远EC20 AT指令手册。文档中强调了提供及时、全面服务的宗旨,并提供了总部联系方式,包括电话、邮箱及网址。手册中包含了一系列的联系...
《Quectel EC20 AT命令...综上所述,《Quectel EC20 AT Commands Manual》是理解并利用EC20模块进行物联网应用开发的重要参考资料,通过学习和掌握其中的AT命令和实践案例,开发者可以高效地构建自己的4G通信解决方案。
首先,文档的标题明确指出这是关于“Quectel EC20 TCPIP AT Commands”的手册,即移远EC20模块的TCP/IP AT命令手册。AT命令是一种用于控制调制解调器和其他通信设备的指令集,常用于无线通信模块中,通过串行端口...
### Linux Makefile 详解 #### 一、Makefile 概述与重要性 在软件开发领域,特别是针对大型项目或跨平台项目,Makefile 的重要性不可小觑。它不仅是一种自动化构建工具的核心配置文件,更是衡量程序员是否掌握工程...
根据给定文件的信息,本文将围绕“Basic Linux Commands”这一主题进行深入解析,重点阐述Linux基本命令的操作方法及其应用场景,并对部分关键概念和技术细节进行详细解释。 ### 基本Linux命令 #### shell与bash ...
本资源"linux_commands_line_env1.1.pdf.zip_Commands-LINUX"是一个关于Linux命令行的宝贵资料,涵盖了各种命令及其详细解释,旨在帮助用户更深入地理解并熟练使用Linux。 1. **基本文件和目录操作**: - `cd`: ...
根据提供的文档信息,“FIBOCOM_L610_AT_Commands_User_Manual_V3.6.5.pdf”是一份关于广和通L610模块的AT指令手册,旨在为用户提供详细的AT命令使用指南。本手册包含了多个版本的迭代记录、版权说明以及具体的AT...
速查表-linux 包含内容: 10-Linux-Unix-Command-Cheat-Sheet-011.jpg 10-Linux-Unix-Command-Cheat-Sheet-021.jpg CliCommandsFull.jpg davechild_linux-command-line.pdf linux file search 305883.jpg ...