Development Environment - View the current folder size under Linux, and sort the files in the folder by size

Sometimes there will be a problem when compiling under Linux: No space left on device (the current disk space is insufficient)

At this time, you need to delete some unnecessary files on the Linux compiler. Normally, I want to delete the largest and most space-consuming files.

 

View the current disk usage under Linux:

Statistics of the overall condition of the disk, including disk size, used and available. Command "df -lh"

grammar:

df [选项]... [FILE]...

参数说明:

    文件-a, --all 包含所有的具有 0 Blocks 的文件系统
    文件--block-size={SIZE} 使用 {SIZE} 大小的 Blocks
    文件-h, --human-readable 使用人类可读的格式(预设值是不加这个选项的...)
    文件-H, --si 很像 -h, 但是用 1000 为单位而不是用 1024
    文件-i, --inodes 列出 inode 资讯,不列出已使用 block
    文件-k, --kilobytes 就像是 --block-size=1024
    文件-l, --local 限制列出的文件结构
    文件-m, --megabytes 就像 --block-size=1048576
    文件--no-sync 取得资讯前不 sync (预设值)
    文件-P, --portability 使用 POSIX 输出格式
    文件--sync 在取得资讯前 sync
    文件-t, --type=TYPE 限制列出文件系统的 TYPE
    文件-T, --print-type 显示文件系统的形式
    文件-x, --exclude-type=TYPE 限制列出文件系统不要显示 TYPE
    文件-v (忽略)
    文件--help 显示这个帮手并且离开
    文件--version 输出版本资讯并且离开

For a more detailed understanding of the "df" command, you can view the link:

https://www.runoob.com/linux/linux-comm-df.html

 

View the current folder size under Linux:

Check the occupation of the folder in detail. Available command "du --max-depth=1 -h"

grammar:

du [-abcDhHklmsSx][-L <符号连接>][-X <文件>][--block-size][--exclude=<目录或文件>][--max-depth=<目录层数>][--help][--version][目录或文件]

参数说明:

    -a或-all 显示目录中个别文件的大小。
    -b或-bytes 显示目录或文件大小时,以byte为单位。
    -c或--total 除了显示个别目录或文件的大小外,同时也显示所有目录或文件的总和。
    -D或--dereference-args 显示指定符号连接的源文件大小。
    -h或--human-readable 以K,M,G为单位,提高信息的可读性。
    -H或--si 与-h参数相同,但是K,M,G是以1000为换算单位。
    -k或--kilobytes 以1024 bytes为单位。
    -l或--count-links 重复计算硬件连接的文件。
    -L<符号连接>或--dereference<符号连接> 显示选项中所指定符号连接的源文件大小。
    -m或--megabytes 以1MB为单位。
    -s或--summarize 仅显示总计。
    -S或--separate-dirs 显示个别目录的大小时,并不含其子目录的大小。
    -x或--one-file-xystem 以一开始处理时的文件系统为准,若遇上其它不同的文件系统目录则略过。
    -X<文件>或--exclude-from=<文件> 在<文件>指定目录或文件。
    --exclude=<目录或文件> 略过指定的目录或文件。
    --max-depth=<目录层数> 超过指定层数的目录后,予以忽略。
    --help 显示帮助。
    --version 显示版本信息。

For a more detailed understanding of the "du" command, you can view the link:

https://www.runoob.com/linux/linux-comm-du.html

 

 

Guess you like

Origin blog.csdn.net/Ivan804638781/article/details/97781794