Linux top command sort by memory / swap
Top command is used often to check linux system loading , or find which processes are slowing down the system, by default top sorts command by %cpu , we can use one of below methods to let top sort processes by memory or swap
1.Using option “-o” of command top to Specifies the name of the field on which tasks will be sorted
top -o %MEM # sort by memory
OR
top -o SWAP # sort by swap
- Use top’s fields managing interactive command “f” or “F”
![](https://linuxtutorials.org/wp-content/uploads/2020/12/topfieldmanaging-720x547.png)
top
a, issue “top” command directly
b, hit key “f” or “F”
c, then you can follow the instruction to toggle and set fields