【问题标题】:why does terminal keeps displaying 'number of files 1'?为什么终端一直显示“文件数 1”?
【发布时间】:2019-05-30 17:19:48
【问题描述】:

请看这张图片: 终端始终显示number of files 1。频率大约是几分钟。重新启动操作系统(对我来说是 centos)并没有帮助,因为我已经看到它好几个月了。虽然它不会影响其他进程,但它会骚扰终端,我必须按 CTRL+C 暂时停止它,我担心某些后台进程总是处于错误状态。它与我显示工作中所需的 gui 文件夹的命令有什么关系吗?

nautilus -q &> /dev/null
nautilus dir1 dir2 .. dirn  &> /dev/null & 
#can prevent the 'number of files 1'.

我用谷歌搜索了关键字“文件数 1”,但似乎没有一个结果与这个问题有关,所以我想知道其他人之前是否遇到过同样的问题。 您能否就如何调试和解决此问题提出一些建议?

[root@localhost cp2vm]# whoami
root
[root@localhost cp2vm]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

strings /usr/bin/nautilus 的输出: http://www.filedropper.com/stringsnautilus

nautilus --version 输出:GNOME nautilus 3.22.3

【问题讨论】:

  • strings $(which nautilus) | grep "number of files"?
  • @ptomato 它返回number of files %d,可以暗示什么?我上传了整个输出并更新了问题。
  • 这意味着是的,number of files 1 来自 nautilus,因此可能与您显示 GUI 文件的命令有关。
  • 这很可能是您的 nautilus 版本中的剩余调试打印。我搜索了当前的 nautilus 代码库并没有找到它,但是您可以通过返回并查看系统所具有的 nautilus 版本的源代码来找到它。
  • 我也没有在source code中找到这样的字符串number of files %d

标签: linux terminal centos gtk nautilus


【解决方案1】:

只需运行nautilus &> /dev/null 以避免鹦鹉螺污染stdoutstderr。这样您的终端就不会显示这些消息。

编辑: 明确地说,这应该可以在您的脚本中使用。

nautilus -q &> /dev/null              # Exits all nautilus instances, ignore output
nautilus dir1 dir2 dir3 &> /dev/null  # Runs nautilus, ignore output

我怀疑输出重定向对nautilus -q 是否有用,但根据您的信息,很难理解您何时以及多久调用该脚本。所以它可能会过剩,但不会造成伤害。

【讨论】:

  • 谢谢,我会在接受作为答案之前监视几天。感谢您对原因进行更多解释。
  • 不幸的是不起作用。我的脚本是这样的:nautilus -q nautilus some dirs & > /dev/null
  • 您必须使用&>,两个字符之间不能有空格。这是stdoutstderr 的重定向。见I/O redirection
  • 还是不行,nautilus -q &> /dev/null nautilus some dirs & &> /dev/null
  • 请在您的问题中发布您的尝试,每行一个命令。此处的格式使您不清楚您是如何输入的,因为没有显示换行符。
猜你喜欢
  • 1970-01-01
  • 2021-03-01
  • 2019-02-23
  • 1970-01-01
  • 2021-11-28
  • 2020-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多