Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
linux中有这个“top”命令,用于测量各种实时CPU指标。
有人可以解释如何使用该命令,以便它每 1 秒更新一次并执行无限时间(或者说直到我想运行它)。此外,如果它可以输出文本文件中的值。
所以我尝试了:
顶部 -n -d 1 -b >> output.txt
但是我应该如何指定 n 的参数值。我不想为 -n 参数设置一些随机值,比如 10000 等。
1.) 每隔一秒解释一次更新:你自己做的:'-d 1'
2.)解释输出到文本文件:你自己做了:'>> output.txt' 这将附加(如果需要创建新的)到文件'output.txt'。
3.)如果你想永远运行它,只需省略参数'-n'。
但注意:如果它“永远”运行:想想你的输出文件会占用文件系统空间!!!