ncdu 磁盘使用分析查看工具

Posted by sysin on 2021-07-11
Estimated Reading Time 2 Minutes
Words 604 In Total
更新日期:Sun Jul 11 2021 13:41:31 GMT+0800,阅读量:

请访问原文链接:ncdu 磁盘使用分析查看工具,查看最新版。原创作品,转载请保留出处。

作者主页:sysin.org


无耻抄袭者 Yu Tao,请立遁!!!

ncdu-freebsd

简介

Ncdu - NCurses Disk Usage

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

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

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

安装

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 退出。


捐助本站 ❤️ Donate

点击访问官方网站


文章用于推荐和分享优秀的软件产品及其相关技术,所有软件默认提供官方原版(免费版或试用版),免费分享。对于部分产品笔者加入了自己的理解和分析,方便学习和测试使用。任何内容若侵犯了您的版权,请联系作者删除。如果您喜欢这篇文章或者觉得它对您有所帮助,或者发现有不当之处,欢迎您发表评论,也欢迎您分享这个网站,或者赞赏一下作者,谢谢!

支付宝赞赏 微信赞赏

赞赏一下


☑️ 评论恢复,欢迎留言❗️
敬请注册!点击 “登录” - “用户注册”(已知不支持 21.cn/189.cn 邮箱)。请勿使用联合登录(已关闭)