Score:3

Launch top with filters?

cn flag
Dan

Is there a way to run top with these filters by default:

filters: '%CPU>0.0' + '!COMMAND=top'

?

Can I pass that via command line options?

Score:4
pl flag

top -i

This option does exclude zombie and idle processes. And it sorts CPU usage greater than zero.

Score:2
ng flag

top:W to save current view configuration

Using W command through top interactive CLI. For more details see man top → Files.

An example, of the saved configuration:

more ~/.config/procps/toprc (Ubuntu 21.10)

top's Config File (Linux processes with windows)
Id:j, Mode_altscr=0, Mode_irixps=1, Delay_time=3.0, Curwin=0
Def fieldscur=���������&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
    winflags=2290996, sortindx=18, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
    summclr=1, msgsclr=1, headclr=3, taskclr=1
Job fieldscur=�����(���@<��)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
    winflags=193844, sortindx=0, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
    summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem fieldscur=���<�����MBN�D34��&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
    winflags=193844, sortindx=21, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
    summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr fieldscur=�����������)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
    winflags=193844, sortindx=3, maxtasks=0, graph_cpus=0, graph_mems=0, double_up=0, combine_cpus=0
    summclr=3, msgsclr=3, headclr=2, taskclr=3
Fixed_widest=0, Summ_mscale=1, Task_mscale=0, Zero_suppress=0

begin: saved other filter data -------------------
window #0, osel_tot=2
    type=111,   filter=!COMMAND=top
    type=111,   filter=%CPU>0.0
end  : saved other filter data -------------------

~/.toprc (Ubuntu 18.04) top does not save or restore filters with W command. I don't know yet when it did change.

Dan avatar
cn flag
Dan
Hm, I tried that ... and it said `Wrote to ... .toprc`-- but then on next launch nothing was preserved.
user.dz avatar
ng flag
@Dan which Ubuntu release do you have? Could you share the saved file though https://paste.ubuntu.com
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.