zoukankan      html  css  js  c++  java
  • Linux命令之ncdu

    简介

    Ncdu - NCurses Disk Usage

    Ncdu 是一个带有 ncurses 接口的磁盘使用分析器。 它旨在在您没有完整图形设置可用的远程服务器上查找空间占用,但即使在常规桌面系统上它也是一个有用的工具。 Ncdu 的目标是快速、简单和易于使用,并且应该能够在安装了 ncurses 的任何最小的类 POSIX 环境中运行。

    主页:https://dev.yorhel.nl/ncdu

    备注:curses 是一个在 Linux/Unix 下广泛应用的图形函数库,作用是可以在终端内绘制简单的图形用户界面。curses 库产生于 BSD UNIX,但是 Linux 系统通过 ncurses 库提供这个功能。

    安装

    ncdu 可以在绝大多数 posix 兼容的系统中运行,几乎在所有的知名 Unix、Linux 系统中可用。

    macOS:

    ## Homebrew
    #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install ncdu

    FreeBSD:

    pkg install ncdu

    Ubuntu:

    sudo apt install ncdu

    CentOS:

    ## Add EPEL repo
    #yum -y install epel-release
    yum install ncdu

    命令用法

    ncdu <options> <directory>

    查看当前目录磁盘使用,直接:

    ncdu
    # 按 Q 键退出

    查看指定目录磁盘使用

    ncdu /  #根目录,全盘
    ncdu /home
    # 按 Q 键退出

    命令帮助:

    ncdu -h
    ncdu <options> <directory>
    
      -h,--help                  This help message
      -q                         Quiet mode, refresh interval 2 seconds
      -v,-V,--version            Print version
      -x                         Same filesystem
      -e                         Enable extended information
      -r                         Read only
      -o FILE                    Export scanned directory to FILE
      -f FILE                    Import scanned directory from FILE
      -0,-1,-2                   UI to use when scanning (0=none,2=full ncurses)
      --si                       Use base 10 (SI) prefixes instead of base 2
      --exclude PATTERN          Exclude files that match PATTERN
      -X, --exclude-from FILE    Exclude files that match any pattern in FILE
      -L, --follow-symlinks      Follow symbolic links (excluding directories)
      --exclude-caches           Exclude directories containing CACHEDIR.TAG
      --confirm-quit             Confirm quitting ncdu
      --color SCHEME             Set color scheme (off/dark)

    彩色显示:

    ncdu --color dark  # off/dark,默认 off
    ncdu --color dark /home

    ncdu 用法

    进入 ncdu 后:

    按 ?调出帮助对话框,按 1 显示快捷键(默认),按 2 显示格式说明,按 3 显示版本信息

    常用快捷键:

    n :按文件名进行排序(再按为切换升降序)
    s :按文件大小进行排序(默认,再按为切换升降序)
    r :重新计算大小
    g :显示百分比

    按 q 退出。

  • 相关阅读:
    转:细说一个汉字等于几个字符,以及汉字,字符,字节,位之间的关系
    iOS8 无缝切换WKWebView,借鉴IMYWebview,解决进度条,cookie,本地页面等问题
    ios加载本地html
    如何做一个细心的人
    学习h5(开始)
    JLRoute 使用
    大二下学期学习进度(四)
    求首尾相接的数组的最大子数组和
    大二下学期学习进度(三)
    构建之法阅读笔记01
  • 原文地址:https://www.cnblogs.com/xingxia/p/linux_ncdu.html
Copyright © 2011-2022 走看看