How to display `top` results sorted by memory usage in real time

memoryterminaltop

How can I display the top results in my terminal in real time so that the list is sorted by memory usage?

Best Answer

Use the top command in Linux/Unix:

top
  • press shift+m after running the top command
  • or you can interactively choose which column to sort on
    • press Shift+f to enter the interactive menu
    • press the up or down arrow until the %MEM choice is highlighted
    • press s to select %MEM choice
    • press enter to save your selection
    • press q to exit the interactive menu

Or specify the sort order on the command line

# on OS-X
top -o MEM
# other distros
top -o %MEM

References

https://stackoverflow.com/questions/4802481/how-to-see-top-processes-by-actual-memory-usage

Related Question