How to check file size in linux

王林
Release: 2022-12-30 11:13:00
Original
11583 people have browsed it

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] 文件或者目录名
Copy after login

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 ./
Copy after login

View the size of a specified directory

[plain] du -sh directory_name
Copy after login

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

[plain] du -sh * | sort -nr | head
Copy after login

Minimum:

[php] du -sh * | sort -n | head
Copy after login

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!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!