How to check the size of a folder in Linux

WBOY
Release: 2022-07-14 16:37:45
Original
133774 people have browsed it

Method: 1. Use the ls command to view the results. This command can display the results in KB, MB, etc. The syntax is "ls -ll" or "ls-lh"; 2. Use "du - h –max-depth=1 *” command, this command can view the size of each file and folder in the current directory; 3. Use the “du -sh” command to view the total size of the current folder; 4. Use “ du -h –max-depth=0 *” command, you can view the size of direct subdirectory files and folders.

How to check the size of a folder in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to check the size of a folder in Linux

1. The simplest way to check is to use the ls -ll and ls-lh commands. When using ls -ll, the size in bytes will be displayed. , and ls-lh will be displayed in units of KB, MB, etc., which is more intuitive.

How to check the size of a folder in Linux

2. Through the command du -h –max-depth=1 *, you can check the size of each file and folder in the current directory. This is more practical.

How to check the size of a folder in Linux

#3. To query the total size of the current directory, you can use du -sh, where s represents the meaning of statistical summary, that is, only a total size is output.

How to check the size of a folder in Linux

4. Similarly, through the command du -h –max-depth=0 *, you can only display the size statistics of direct subdirectory files and folders.

How to check the size of a folder in Linux

#5. If you only want to view the total size of the specified directory, you can use du -sh directory name.

How to check the size of a folder in Linux

#6. You can also specify the display level depth for the specified folder, such as du -h --max-depth=0 software/ and du -h --max-depth =1 software/

How to check the size of a folder in Linux

Recommended learning: Linux video tutorial

The above is the detailed content of How to check the size of a folder in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template