In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the df command to check disk space in Linux. I believe most people don't know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.
On Linux-based systems, we can use the df command to get more information about the system's disk space usage.
Linux df command
The df command can be used to check disk footprint, or disk usage, in the Linux file system.
"if used without any parameters, the df command displays information about all mounted file systems:"
# df
Output:
Filesystem 1K-blocks Used Available Use% Mounted ondev 8172848 0 8172848 / devrun 8218640 1696 8216944 1% / run/dev/nvme0n1p3 222284728 183057872 27865672 87% / tmpfs 8218640 150256 80683842 / dev/shm/dev/nvme0n1p1 523248 107912 415336 21% / boot/dev/sda1 480588496 172832632 283320260 38% / data
Each line includes information about the file system name (Filesystem), size (1K-blocks), used space (Used), free space (Available), percentage of used space (Use%), and information about the directory in it that the file system is mounted (Mounted on).
How do I display disk space usage in a human readable format?
By default, the df command displays disk space in 1 KB and the amount of used and available disk space in kilobytes.
This is very inconvenient, how to display disk space usage in human-readable formats (megabytes and gigabytes)?
To view information in human-readable formats (megabytes and gigabytes), you need to pass the following-h option:
# df-h
Output:
Filesystem 1K-blocks Used Available Use% Mounted onFilesystem Size Used Avail Use% Mounted ondev 7.8G 0 7.8G 0% / devrun 7.9G 1.8m 7.9G 1% / run/dev/nvme0n1p3 212G 176G 27G 88% / tmpfs 7.9G 145m 7.7G 2% / dev/shm/dev/nvme0n1p1 511M 106M 406M 21% / boot/dev/sda1 459G 165G 271G 38% / data
How do I display the file system type?
To display the file system type, you need to use the command following the-T option below df:
# df-t
Output:
Filesystem Type 1K-blocks Used Available Use% Mounted ondev devtmpfs 8172848 0 8172848 / devrun tmpfs 8218640 1744 8216896 1% / run/dev/nvme0n1p3 ext4 222284728 183666100 27257444 88% / tmpfs tmpfs 8218640 383076 78355564% / dev/shm/dev/nvme0n1p1 vfat 523248 107912 415336 21% / boot/dev/sda1 ext4 480588496 172832632 283320260 38% / data
"if you want to restrict the list to a specific type of file system, use the option of-t followed by type." For example, list all ext4 partitions to run:
# df-t vfat
Output:
Filesystem 1K-blocks Used Available Use% Mounted on/dev/nvme0n1p1 523248 107912 415336 21% / boot
Similar to the above, use the-x option to limit output to non-specific types of file systems.
How do I display Inode usage?
"when used with the-I option, the df command displays information about file system inode usage." For example, to display information about inode mounted to the system root / file system in a human-readable format, you will use:
# df-ih /
Output:
Filesystem Inodes IUsed IFree IUse% Mounted on/dev/nvme0n1p3 14m 1.9m 12m 14% /
Description: inode is a data structure in the Unix/Linux file system, which contains information about a file or directory, such as its size, owner's User ID, file read, write, execution permissions, and so on.
How do I specify the output format?
The df command can specify the output format, and to limit the information fields displayed in the df output, you need to use the "--output [= FIELD_LIST]" option. Where "FIELD_LIST" is a comma-separated list of columns to be included in the output; each field can only be used once.
Valid field names are:
● source-File system source.
● fstype-File system type.
Total number of ● itotal-inode.
● iused-number of inode used.
● iavail-number of available inode.
● ipcent-percentage of inode used.
● size-Total disk space.
● used-used disk space.
● avail-available disk space.
● pcent-percentage of space used.
● file-if the file name is specified on the command line.
● target-installation point.
For example, display the output of all ext4 partitions in a human-readable format, showing only the file system name and size and the percentage of used space that will be used:
# df-h-t ext4-- output=source,size,pcent
Output:
More than 38% of Filesystem Size Use%/dev/nvme0n1p3 212G 88%/dev/sda1 459g is all the contents of the method of checking disk space using the df command in Linux. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.