如何在'top'命令的输出中禁用颜色?

Put*_*nik 4 linux colors top terminal

我正在尝试处理“顶级”输出以设置 CPU 性能数据。当我只是 grep 输出它是彩色的: 在此处输入图片说明 或者 在此处输入图片说明 数字是粗体的,它在输出中添加了很多不必要的数据: 在此处输入图片说明

我试图去除颜色代码答案,但它不起作用。为了性能,我想在该问题中避免其他更复杂的答案。

我试图通过切换术语模式禁用颜色,但没有运气: 在此处输入图片说明

那么如何禁用颜色输出呢?

PS:我找到了如何获取数据:我只能使用数字 awk 然后它可以工作,但仍然想知道是否有任何方法可以在此处禁用颜色。

iga*_*gal 5

这是禁用彩色输出的一种方法top

第 1 步:运行 top

第二步:按z键切换颜色模式

第 3 步:按W键保存新设置

作为参考,请查看顶部手册页,特别是第 4 节:交互命令。您将在那里找到这两个交互式命令的以下说明:

W  :Write-the-Configuration-File
    This will save all of your options and toggles plus the
    current display mode and delay time.  By issuing this command
    just before quitting top, you will be able restart later in
    exactly that same state.

z  :Color/Monochrome toggle
    Switches the `current' window between your last used color
    scheme and the older form of black-on-white or white-on-black.
    This command will alter both the summary area and task area
    but does not affect the state of the `x', `y' or `b' toggles.
Run Code Online (Sandbox Code Playgroud)

另请参阅这些相关帖子:


归档时间:

查看次数:

3579 次

最近记录:

6 年,1 月 前