linux command to view file size

1. View the memory status of the virtual machine

df -hl
1

Insert picture description here

2. Check the Linux directory size

du -sh /*
1

Insert picture description here

3. View the total size in the current directory

du -sh
1

Insert picture description here

4. Check the file size in the current directory

du -sh /home/*
1

Insert picture description here

du -h -x --max-depth=1
1

Insert picture description here

5. ls simple instructions

5.1. View hidden files (file prefix with dots)

ls -al  
1

Insert picture description here

5.2. The files in the current directory are sorted in descending order by size (k/M/G) (the sorting of folders is not accurate)

ls -Shl
1

Disadvantages: This command can only view the size of each folder under the current directory, but does not include the things under each folder. This command is generally used to view the file size (not the folder size) in the last level directory Insert picture description here

5.3. Display files in the form of k/M/G

ls -hl
1

Insert picture description here Insert picture description here

6. Rules between instructions

h   以M,G的格式展现
S   从大到小排列文件(大写 S)
l   展示详细信息
a  显示隐藏文件

The above is the Linux-related knowledge shared by Liangxu Tutorial Network for all friends.

Guess you like

Origin blog.csdn.net/manongxianfeng/article/details/113091448