Home >Operation and Maintenance >Linux Operation and Maintenance >How to check the size of files and folders in a directory in Linux

How to check the size of files and folders in a directory in Linux

王林
王林Original
2019-12-26 16:13:4112364browse

How to check the size of files and folders in a directory in Linux

The simplest way to view it is to use the ls -ll, ls-lh command. When using ls -ll, it will be displayed into bytes, while ls-lh will display it in KB, MB, etc., which is more intuitive.

How to check the size of files and folders in a directory in Linux

Through the command du -h –max-depth=1 *, you can view the size of each file and folder in the current directory

Free video tutorial sharing: linux video tutorial

How to check the size of files and folders in a directory in Linux

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 outputs a total size

How to check the size of files and folders in a directory in Linux

Through the command du -h –max-depth=0 *, you can only display the direct Subdirectory file and folder size statistics

How to check the size of files and folders in a directory in Linux

If you only want to view the total size of the specified directory, you can usedu -sh directory name

How to check the size of files and folders in a directory in Linux

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

How to check the size of files and folders in a directory in Linux

Recommended related articles and tutorials: linux tutorial

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

Statement:
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