What is the command to check the folder size in Linux?

coldplay.xixi
Release: 2020-09-10 14:06:07
Original
57447 people have browsed it

Linux command to view the folder size: 1. To view the space occupied by each file and directory in the current directory, the command is [du -sh *]; 2. To view the size of files and folders in a directory, the command is [du -h --max-depth=1 /data/home/lisen/].

What is the command to check the folder size in Linux?

Linux command to view the folder size: du command

1. View each file in the current directory And the space occupied by the directory

du -sh *
Copy after login

2. Check the size of files and folders in a directory

du -h --max-depth=1 /data/home/lisen/   # depth表示只显示一层文件夹大小,即深度为1
Copy after login

What is the command to check the folder size in Linux?

3. Check the total size of a directory

du -sh ./   # 查看当前目录的总大小
Copy after login

4. Check the size of files in a directory and sort them

du -sh *|sort -n   # 这个不能正常排序,需去掉-h
du -s *|sort -n  
du -s *|sort -nr   # 反向排序
du -s *|sort -n |head -5 # 前五个最大的
du -s *|sort -n |tail -5 # 后五个最小的
Copy after login

Related learning Recommended: linux video tutorial

The above is the detailed content of What is the command to check the folder 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template