Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux view disk space

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you linux how to check disk space, I hope you will learn something after reading this article, let's discuss it together!

Linux to view disk space: 1, using the df command, you can view the file system, and get how much space the hard disk is occupied, how much space is left and other information. 2. Using the du command, you can display the disk space usage.

1. Use the df command

Df looks at the file system in terms of disk partitions and can get information such as how much space the hard disk is occupied and how much space is left.

For example, we use the df-h command to view disk information, and the-h option displays appropriately according to size:

Display content parameter description:

Filesystem: file system

Size: partition siz

Used: capacity used

Avail: capacity that can also be used

Percentage used by Use%:

Mounted on: Mount point

2. Use the du command

The original meaning of du is disk usage, which means to show the use of disk space and is used to view the total size of the current directory.

For example, view the size of the current directory:

# du-sh605M.

Displays the space occupied by the specified file:

# du log2012.log 300 log2012.log

An easy-to-read format shows the space occupied by the test directory:

# du-h test608K test/test6308K test/test44.0K test/scf/lib4.0K test/scf/service/deploy/product4.0K test/scf/service/deploy/info12K test/scf/service/deploy16K test/scf/service4.0K test/scf/doc4.0K test/scf/bin32K test/scf8.0K test/test31.3M test

The du command is used to view the total size of the current directory:

-s: only the total number of blocks occupied is given for each Names parameter.

-a: recursively displays the number of data blocks occupied by each file in the specified directory and in each subdirectory. If neither-s nor-an is specified, only the number of disk blocks occupied by each directory and its subdirectories in the Names is displayed.

-b: lists disk space usage in bytes (the system defaults to k bytes).

-k: lists disk space usage in 1024 bytes.

-c: finally, add a total (the system default).

-l: calculate all file sizes, and for hard-linked files, calculate multiple times.

-x: directories skipped on different file systems are not counted.

-h: to improve the readability of the information in the unit of K _ (Magi) M _ (G).

After reading this article, I believe you have some understanding of "how to check disk space in linux". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report