ncdu 磁盘使用分析查看工具

简介

Ncdu - NCurses Disk Usage

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

主页:NCurses Disk Usage

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

安装

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

macOS:

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

FreeBSD:

1
pkg install ncdu

Ubuntu:

1
sudo apt install ncdu

CentOS:

1
2
3
## Add EPEL repo
#yum -y install epel-release
yum install ncdu

命令用法

ncdu <options> <directory>

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

1
2
ncdu
# 按 Q 键退出

查看指定目录磁盘使用:

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

命令帮助:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)

彩色显示:

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

详细帮助请查看:man ncdu

ncdu 用法

进入 ncdu 后:

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

ncdu-help

常用快捷键:

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

按 q 退出。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值