Linux工具之agedu命令

一、agedu工具简介

  agedu扫描目录树,生成关于每个目录和子目录中使用了多少磁盘空间的报告,以及磁盘空间的使用情况如何对应于很久以前最后一次访问的文件。
  换句话说,agedu是一个可以帮助您释放磁盘空间的工具。它可以让你看到哪些目录占用了最多的空间,就像du所做的那样;但与du不同的是,它还区分了仍在使用的大型数据集和数月或数年内未被访问的数据集——例如,下载、解包、使用过一次、从未清理过的大型档案。du帮助你找到什么在使用你的磁盘空间,agedu帮助你找到什么在浪费你的磁盘空间。
  agedu有几种操作模式。在一种模式下,它扫描你的磁盘并构建一个包含数据结构的索引文件,该结构允许它高效地检索可能需要的任何信息。通常,您会先在这种模式下使用它,然后在多种“查询”模式下运行它,以显示特定目录及其子目录的磁盘空间使用情况报告。这些报告可以生成为纯文本(很像du)或HTML。agedu甚至可以作为小型web服务器运行,为每个目录的HTML报告提供超链接,让您在文件系统中导航到其他目录的类似报告。

二、使用示例

1、命令安装

#需要先安装了yum epel扩展源
[root@s146 ~]# yum install -y agedu

2、获取命令帮助

[root@s146 ~]# man agedu
[root@s146 ~]# agedu --help
usage: agedu [options] action [action…]

3、查看命令版本

[root@s146 ~]# agedu -V
agedu, revision 20200705.2a7d4a2

4、查看软件授权

在这里插入图片描述

#agedu是免费软件,基于MIT授权协议。
[root@s146 ~]# agedu --licence

5、扫描指定用户家目录

[root@s146 ~]# agedu -s /home/wuhs/
Built pathname index, 4 entries, 506 bytes of index
Faking directory atimes
Building index
Final index file size = 704 bytes

6、查看索引文件URL

[root@s146 ~]# agedu -w
Using Linux /proc/net magic authentication
URL: http://localhost:51802/

7、使用终端模式访问agedu报告

[root@s146 ~]# agedu -s /var
Built pathname index, 6596 entries, 631180 bytes of index
Faking directory atimes
Building index
Final index file size = 2076552 bytes
[root@s146 ~]# agedu -t /var
388544 /var/cache
8 /var/db
103364 /var/lib
4100 /var/log
16 /var/spool
496048 /var

8、删除索引文件

在这里插入图片描述

[root@s146 ~]# agedu -R

9、指定URL报告的IP地址和端口

  • 使用-s扫描目录并生成索引文件,使用-w生成报告URL,并指定报告临时地址和端口、验证方式
    agedu -s /home/ -w --address 192.168.0.146:9999 --auth basic
    在这里插入图片描述
  • 访问url,使用生成的账户登录
    在这里插入图片描述
  • 查看报告
    在这里插入图片描述

三、使用语法及参数说明

1、使用语法

用法:agedu [options] action [action…]

2、行为说明

行为参数 行为说明
-s, --scan directory 扫描并索引目录
-w, --web 从临时web服务器提供HTML报告
-t, --text subdir 在子目录上打印纯文本报告
-R, --remove 删除索引文件
-D, --dump 将索引文件转储到stdout上
-L, --load 加载并索引转储文件
–presort 准备一个转储文件进行排序
–postsort 在排序后取消准备转储文件
-S, --scan-dump 仅目录扫描,生成转储
-H, --html subdir 在子目录上打印HTML报告
–cgi 从CGI脚本运行时要做正确的事情

3、参数说明

参数 适用模式 参数说明
-f, --file filename [most modes] 指定索引文件
–cross-fs [–scan] 跨文件系统边界
–no-cross-fs [–scan] 坚持一个文件系统
–prune wildcard [–scan] 删减匹配模式的文件
–prune-path wildcard [–scan] 删减路径名匹配模式
–exclude wildcard [–scan] 排除匹配模式的文件
–exclude-path wildcard [–scan] 排除路径名匹配模式
–include wildcard [–scan] 包含匹配模式的文件
–include-path wildcard [–scan] 包含路径名匹配模式
–progress [–scan] 在stderr上报告进度
–no-progress [–scan] 不报告进度
–tty-progress [–scan] 如果stderr是tty,则报告进度
–dir-atime [–scan,–load] 在目录上保留真实的时间
–no-dir-atime [–scan,–load] 目录上的假时间
–launch shell-cmd [–web] 将基本URL传递给给定的命令
–no-eof [–web] 不要关闭eof上的web服务器
–mtime [–scan] 使用mtime而不是atime
–logicalsize [–logicalsize] 使用逻辑文件大小而不是物理文件大小
–files [–web,–html,–text] 列出有效文件
-r, --age-range age[-age] [–web,–html] 设置颜色编码的限制
-o, --output filename [–html] 指定输出文件或目录名
–numeric [–html] 以数字命名输出文件
–address addr[:port] [–web] 指定HTTP服务器地址
–auth type [–web] 指定HTTP身份验证方法
–auth-file filename [–web] 从文件读取HTTP基本用户/传递
–auth-fd fd [–web] 从文件读取HTTP基本用户/传递
–title title [–web,–html] 网页的标题前缀
-d, --depth levels [–text,–html] 递归到这么多级别
-a, --age age [–text] 只包括比此文件早的文件
-h, --help - 获取命令帮助
-V, --version - 查看命令版本
–licence - 显示MIT协议文本内容

猜你喜欢

转载自blog.csdn.net/carefree2005/article/details/124254821