How to check file size in linux

王林
王林Original
2021-01-28 16:47:2311716browse

How to check the file size in Linux: View it by executing the [du -ahskm file or directory name] command. If you want to check the size of a specified directory, you can use the command [du -sh directory_name].

How to check file size in linux

The operating environment of this article: red hat enterprise linux 6.1 system, thinkpad t480 computer.

(Learning video sharing: linux video tutorial)

Detailed introduction:

Command: du

Grammar format:

[plain] du [-ahskm] 文件或者目录名

Parameter explanation -a: List the capacity of all files and directories, because by default only the capacity of the directory is counted

-h: Presented in a capacity format that is easier for people to read (G/M/ K) Display, automatically select the displayed unit size

-s: List the total amount, not the capacity occupied by each individual directory

-k: Perform in KB Display

-m: Display in MB units Common command reference

View the size of the current directory

[plain] du -sh ./

View the size of a specified directory

[plain] du -sh directory_name

In Display the 10 directories or files with the largest (smallest) space in the specified directory. Maximum:

[plain] du -sh * | sort -nr | head

Minimum:

[php] du -sh * | sort -n | head

Related recommendations: linux tutorial

The above is the detailed content of How to check file size 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