Macos 在';顶部';默认情况下?
当我在Macbook(BSD?)上运行Macos 在';顶部';默认情况下?,macos,freebsd,Macos,Freebsd,当我在Macbook(BSD?)上运行top时,我几乎总是想按CPU%排序 它似乎不是默认值,所以我最后键入“o”(排序),然后键入“cpu”,然后按enter键 一直都是 有没有办法将“按CPU%排序”设置为默认值或其他值?%CPU是我使用过的每个系统的默认排序列。但如果不是,您可以按Shift-P按%CPU排序。请注意,交互式帮助中没有列出它,只有手册页 M %MEM N PID P %CPU T TIME+ top-o+%C
top
时,我几乎总是想按CPU%排序
它似乎不是默认值,所以我最后键入“o”(排序),然后键入“cpu”,然后按enter键
一直都是
有没有办法将“按CPU%排序”设置为默认值或其他值?%CPU是我使用过的每个系统的默认排序列。但如果不是,您可以按Shift-P按%CPU排序。请注意,交互式帮助中没有列出它,只有手册页
M %MEM
N PID
P %CPU
T TIME+
top-o+%CPU
正如John Kugelman所说,通常%CPU是默认的排序列。无论如何,阅读手册顶部(1)似乎是个好主意。查看顶部手册页,您可以使用选项
-o%CPU
,尽管这应该已经是默认选项。您可以在.bashrc(alias top='top-o%CPU'
)中创建一个别名,使其永久化
-o :Override-sort-field as: -o fieldname
Specifies the name of the field on which tasks will be sorted, independent of what is reflected in the configuration file. You can prepend a '+' or '-' to the field name to
also override the sort direction. A leading '+' will force sorting high to low, whereas a '-' will ensure a low to high ordering.
This option exists primarily to support automated/scripted batch mode operation.
另一种方法是在
top
中建立您喜欢的排序,然后按W
保存配置。下次启动top
时,它将加载配置
按
top
中的h
查看键盘快捷键。可能值得检查,以确保没有为top设置具有不同排序选项的别名,如top=“top-u”#将其放入.bash_别名文件中。后来的命令行选项会特别覆盖以前的选项,所以你可以用这样的命令设置默认值。我很笨,在使用Mac时在stackoverflow linux中发布了这篇文章:Dooo从来不知道这一点,太棒了,谢谢!这在运行macOS High Sierra 10.13.4的Mac上不起作用。这适用于[distrosOn OS X it'stop-o cpu