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/].
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 *
2. Check the size of files and folders in a directory
du -h --max-depth=1 /data/home/lisen/ # depth表示只显示一层文件夹大小,即深度为1
3. Check the total size of a directory
du -sh ./ # 查看当前目录的总大小
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 # 后五个最小的
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!