linux - Fuser 无法统计文件 - 奇怪的行为

标签 linux bash stat

1.创建文件:

touch 1.txt

2.循环

for i in {0..1000}; do fuser 1.txt;done

3.观看约 50 次失败:

...
Cannot stat file /proc/16927/fd/0: No such file or directory
Cannot stat file /proc/17821/fd/0: No such file or directory
Cannot stat file /proc/17823/fd/0: No such file or directory
...

4.为什么会失败?

5.附加信息:本地 FS、ext3、stat 始终返回有效响应、'selinux' 关闭

最佳答案

我假设 fuser 遍历正在运行的进程并查找指向相关文件的打开的 fd,并且在该尝试期间,一些进程在 fuser 检查它们期间死亡。 – 伊坦·雷斯纳

关于linux - Fuser 无法统计文件 - 奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29134268/

相关文章:

linux - 如何组合两个 AWK 命令?

bash - 如何使用 sed 删除特定字符后面的数字?

macos - 使用命令行向图像添加透明像素行

macos - Mac OS X 文件的 st_flags(用户定义标志)是什么?

linux - Perl:从 star 命令获取用户名和组名

android - 通过 NodeJS 和 Termux 与 Android 蓝牙设备通信

Linux 共享内存分配行为

linux - logrotate 非 .log

html - 如何在 bash 中从 HTML 文档中提取特定文本?

r - 在R中使用scale函数后如何获得中心和比例