• go工具-显示磁盘使用情况的工具diskusage


    go工具-显示磁盘使用情况的工具diskusage

    使用 go 开发一个工具来显示当前的磁盘使用情况。
    官方: https://github.com/chenquan/diskusage

    安装:
    go install github.com/chenquan/diskusage@latest

    [root@dev workspace]# diskusage -h
    A tool for showing disk usage.
    
    Usage:
      diskusage [flags]
    
    Flags:
      -a, --all             display all directories, otherwise only display folders whose usage size is not 0
      -c, --color string    set color output mode. optional: auto, always, ignore (default "auto")
      -d, --depth int       shows the depth of the tree directory structure (default 1)
          --dir string      dir path (default "./")
      -f, --filter string   regular expression filter (default ".+")
      -h, --help            help for diskusage
      -t, --type strings    only count certain types of files  (default all)
      -u, --unit string     displayed units. optional: B(Bytes), K(KB), M(MB), G(GB), T(TB) (default "M")
    [root@dev workspace]#
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    -a 显示所有目录,否则仅显示使用大小不是0的文件夹
    -c 设置颜色输出模式。可选:自动,始终忽略(默认“自动”)
    -d 显示树目录结构的深度(默认1)
    -f 正则表达式过滤器(默认".+")
    -t 仅计算某些类型的文件(默认所有文件)
    -u 显示单位。可选:B(字节),K(KB),M(MB),G(GB),T(TB)(默认为“ M”)

    demo命令:

    diskusage -a -c always -d 1 -u G
    
    • 1

    例子
    计算名为 coc 或 docx 的文件: diskusage -t doc,docx或diskusage -f ".+\.(doc|docx)$"
    最大显示单位为GB:diskusage -u G
    支持颜色输出到管道:` diskusage -c always | less -R ``

  • 相关阅读:
    线性代数学习笔记6-2:行列式的理解、行列式的性质
    Vue学习笔记(十一):路由管理
    AFL模糊测试+GCOV覆盖率分析
    Linux下调试代码——gdb的使用
    Linux---进程(1)
    自定义指令下拉菜单隐藏
    2024年公司加密软件排行榜(企业加密软件推荐)
    罗丹明PEG巯基,Rhodamine PEG Thiol,RB-PEG-SH
    文件搜索工具测试
    hex文件合并
  • 原文地址:https://blog.csdn.net/inthat/article/details/126303815