使用hcache查看使用buff/cache的目录文件

简介: 我是使用的git从github拉取下代码,然后重新编译的, 因为此项目是go语言写的,所以编译时需要安装go语言如下命令下载代码,或者直接下载zip压缩包,资源在 “此目录下文档中所用的资源” 目录中

使用hcache查看使用buff/cache的目录文件

我是使用的git从github拉取下代码,然后重新编译的, 因为此项目是go语言写的,所以编译时需要安装go语言

如下命令下载代码,或者直接下载zip压缩包,资源在 “此目录下文档中所用的资源” 目录中

git clone git@github.com:silenceshell/hcache.git

进入主目录,编译,然后将编译后的文件拷贝到/usr/local/bin目录下,即可使用

cd hcache
make build
sudo cp hcache /usr/local/bin/

使用:

hcache <-json <-pps>|-terse|-default> <-nohdr> <-bname> file file file
 -json output will be JSON
   -pps include the per-page information in the output (can be huge!)
 -terse print terse machine-parseable output
 -default print ascii tables
 -histo print a histogram using unicode block characters
 -nohdr don't print the column header in terse or default format
 -bname use basename(file) in the output (use for long paths)
 -plain return data with no box characters
 -unicode return data with unicode box characters
 -pid int show all open maps for the given pid
 -top int show top x cached files
$ hcache --top 10
[sudo] password for silenceshell: 
+----------------------------------------------------------------------------------+----------------+------------+-----------+---------+
| Name                                                                             | Size (bytes)   | Pages      | Cached    | Percent |
|----------------------------------------------------------------------------------+----------------+------------+-----------+---------|
| /opt/google/chrome/chrome                                                        | 114911208      | 28055      | 25457     | 090.740 |
| /usr/share/code/code                                                             | 67688720       | 16526      | 12274     | 074.271 |
| /home/silenceshell/Software/pycharm-community-2016.2/lib/pycharm.jar                   | 95177431       | 23237      | 11325     | 048.737 |
| /opt/atom/atom                                                                   | 62641344       | 15294      | 10578     | 069.164 |
| /usr/bin/dockerd                                                                 | 39121168       | 9552       | 7103      | 074.361 |
| /home/silenceshell/Software/pycharm-community-2016.2/jre/jre/lib/amd64/libjfxwebkit.so | 57455824       | 14028      | 6625      | 047.227 |
| /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2                                  | 36462184       | 8902       | 6316      | 070.950 |
| /usr/lib/beyondcompare/BCompare                                                  | 30640160       | 7481       | 5505      | 073.586 |
| /usr/bin/SecureCRT                                                               | 29524560       | 7209       | 4806      | 066.667 |
| /usr/share/code/libnode.so                                                       | 21135976       | 5161       | 4588      | 088.898 |
+----------------------------------------------------------------------------------+----------------+------------+-----------+---------+
$ 
$ hcache --top 3  --bname  
+-------------+----------------+------------+-----------+---------+
| Name        | Size (bytes)   | Pages      | Cached    | Percent |
|-------------+----------------+------------+-----------+---------|
| chrome      | 114911208      | 28055      | 25476     | 090.807 |
| pycharm.jar | 95177431       | 23237      | 11479     | 049.400 |
| atom        | 62641344       | 15294      | 10578     | 069.164 |
+-------------+----------------+------------+-----------+---------+ 
$ 
$ lsof /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2 
COMMAND    PID   USER  FD   TYPE DEVICE SIZE/OFF    NODE NAME
quiterss 20630 silenceshell mem    REG    8,5 36462184 3936610 /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2

根据上面github给的示例,我们可以发现常用的两个命令为:

在root用户下使用:

1.显示top n的缓存目录

hcache --top 10

2.显示top n 的缓存目录的基本信息,包括大小

hcache --top 3  --bname
目录
相关文章
|
8月前
|
Linux
linux下清理buffer/cache
linux下清理buffer/cache
|
6月前
|
Java
File常用的方法操作、在磁盘上创建File、获取指定目录下的所有文件、File文件的重命名、将数据写入File文件
这篇文章介绍了Java中`File`类的常用方法操作,包括文件和目录路径名的抽象表示、构造方法、常用方法以及代码实例。文章通过具体的代码示例,展示了如何在磁盘上创建文件和目录、处理目录存在的情况、文件重命名、获取指定目录下的所有文件以及将数据写入文件等操作。每个代码实例都配有测试结果截图,帮助读者更好地理解和掌握`File`类的应用。
File常用的方法操作、在磁盘上创建File、获取指定目录下的所有文件、File文件的重命名、将数据写入File文件
|
5月前
用free命令看到的cache跟/proc/meminfo看到的为什么不同?
用free命令看到的cache跟/proc/meminfo看到的为什么不同?
|
6月前
|
Linux
Linux——如何清除buff/cache
Linux——如何清除buff/cache
59 0
|
8月前
|
存储 缓存 API
file_cache: 使用文件缓存函数结果
file_cache: 使用文件缓存函数结果
89 15
|
8月前
|
Java
Files.find 去除部分目录/dev/fd,/proc如何操作
在使用 `Files.find` 方法时,如果你想在搜索过程中排除特定目录,如 `/dev/fd` 和 `/proc`,可以在 `BiPredicate` 实现中添加相应的逻辑。以下是一个示例,演示如何在 `Files.find` 中排除这些目录: ```java import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; imp
|
Shell
使用 shell 脚本清理内存 buff/cache
使用 shell 脚本清理内存 buff/cache
199 0
|
Linux
8.Linux文件管理命令---head显示文件头部--tail显示文件尾部
8.Linux文件管理命令---head显示文件头部--tail显示文件尾部
132 0
|
缓存 Linux
关于linux操作系统中的buff/cache
linux操作系统中的buff/cache学习
278 0
|
SQL 缓存 Linux
Linux清除缓存buff/cache
Linux清除缓存buff/cache
544 0