Reset 'Top' command default view on Mac OSX
I met a problem when using linux top command on macOS. The default top open view now looks like
It displays too many unnecessary columns and didn't sort by CPU or MEM by default. I remember it used to be like
Anyone know how to change it back? I've checked my home folder that there is no .toprc file.
Thanks in advance.
top will generally display as many columns as the width of your window will allow. But to change the sort to cpu (high to low), you can type the following within top:
o
to select primary sort
-cpu
to sort by decreasing CPU usage
You can add a secondary sort if desired:
O
to select secondary sort
-mem
to sort by decreasing memory usage
?
will show you all options, along with the current sort selections - see below image:
You can also call these options explicitly from the command line, if desired, like this:
To see your longest running processes
top -o time -user $(whoami)
top
store user preferences in .toprc
file. Check if such file exist into your home :
ll ~/.toprc
-rw-rw-r-- 1 dba dba 617 Nov 29 11:16 /home/dba/.toprc
If you want to definitively reset your preferences, simply delete this file and restart top
rm ~/.toprc
top