How can you display the top results in my terminal in real time so that the list is sorted by memory usage?
- Use quick tip using top command in linux/unix
- hit Shift + f, then choose the display to order by memory usage by hitting key n then press Enter. You will see active process ordered by memory usage.
- Or you can just press M after running the top command.
- On OS X 10.10 the command top -o MEM seems to work.
Use quick tip using top command in linux/unix
- and then hit Shift+m (i.e. write a capital M).
From man top
- Or alternatively: hit Shift + f , then choose the display to order by memory usage by hitting key n then press Enter. You will see active process ordered by memory usage
If top is already running, press o . Above the data, a prompt will appear:
- Where xxxxx is the current sorting key. Type the name of the column by which you want to sort. If a column name contains “%” or “#”, omit the character.
- For example, %CPU, just type “cpu”.
The command line option -o (o standing for “Override-sort-field”) also works on my Xubuntu machine and according to the Mac man page of top it should work on a Macintosh too. If you want to short by memory usage you usually use
- which sorts by the column %MEM. But you can use VIRT, RES or SHR too. On a Macintosh you would probably use mem or vsize.