21

Can I somehow modify htop's default view to display processes sorted by CPU usage? I want htop to "remember" my view/sort method.

If it's relevant, I'm currently on Xubuntu 13.10.

20

Run htop, press F6, select CPU%.

Quit by using F10

If it doesn't remember your settings check your ~/.config/htop/htoprc file if it is writable by your user. You might make it writable like this:

chown $USER ~/.config/htop/htoprc

Or you can try removing it and let htop generate a new one, maybe the old one is corrupted somehow.

rm ~/.config/htop/htoprc
4
  • Thank you. Well the thing is, the next time I run htop, it doesn't remember my selection. – henry Jan 5 '14 at 21:41
  • @henry I updated my answer. Still doesn't help? – falconer Jan 5 '14 at 21:47
  • Deleted the file, it's now sorted by CPU by default. Again, that is, don't know why it wouldn't switch back. Thank you. – henry Jan 5 '14 at 21:53
  • 2
    Also, to save your settings when you quit, use F10 to quit instead of pressing q. – BallpointBen Jun 17 '17 at 2:51
10

I noticed I had to actually quit properly using F10 and not Ctrl + C for htop to save the sort by column.

3
  • Please make sure to write a complete answer instead of a partial one. Even though others may have provided the information doesn't mean it should be left out of your answer. You could also leave a comment in case you just wanted to let the poster know. – Xweque Feb 22 '15 at 20:05
  • 1
    Whats wrong with my answer?? – John Mark Scarborough Feb 23 '15 at 20:54
  • It's probably best to mention how to change the sort order in the first place. – LovesTha May 2 '17 at 3:06
2

Other solutions are better, but if all else fails, you can make an alias for htop -s PERCENT_CPU.

2
  • This is useful when its not possible to transmit the F6 keypress - such as when connecting via Putty (Windows) – svandragt Jun 30 '16 at 9:30
  • @svandragt Maybe I have a newer version of putty, but the F6 key is working on windows 7 with putty. – Joshua Pack Nov 4 '16 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.