Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Under SuSE, (Mem: 31908592k total, 31421504k used,) how do i know which process or program using my memory?

share|improve this question

4 Answers 4

up vote 20 down vote accepted

The standard (command-line) program for checking cpu/memory usage for processes is top there is also a slightly more feature-full htop however on a lot of systems its bound to top anyway (same way bash is almost always bound to sh on most modern linux systems). There are also various GUI wrappers for top/htop available

After opening top, clicking M will sort by memory usage.

EDIT - 4-12 For clarity I decided to expand on the sorting. Here is a typical top window when run from the terminal shell, this is already sorted by %MEM

enter image description here

The column that interests you most is %MEM which will give you the share of total available memory used by that process. VIRT gives the virtual memory footprint of the process, of which only RES amount is currently in physical memory (the rest is swapped out, and not currently shown on the table)

In order to sort by a column you hit F (shift-F) and the screen will change to the following

enter image description here

as you can see, hitting n will select sort by memory percentage (hit enter to return back to the table view). (There is a legacy shortcut Shift-m that will toggle sort by memory when hit on the table view) You can use < and > in the table view (shift - , and shift-.) to cycle the column that is sorted.

At the table view, hitting lowercase m will toggle the memory summary view. enter image description here

Note: I played around with sorting columns so the columns are shuffled from the first image.

Like a lot of unix/linux command line utilities there are many little tricks and things and hidden features - top is a very powerful tool. For instance, you can show multiple tables at the same time (say the top 5 instead of top 20 but for 4-5 different parameters)- how? I don't know, but I accidentally got to that when taking the screenshots. A full chapter of a good book on *nix can be devoted to top, so the summary above is just a small primer to get what you need to know about your processes.

share|improve this answer
    
Crasic, thank you for your answer, i know top command will show you:(Mem: 31908592k total, 31153712k used, 754880k free,) but whant i need to know is were all this memory is used. –  AlBouazizi Apr 13 '11 at 8:10
    
Look in the "%MEM" column of top. –  Daniel Andersson Apr 13 '11 at 12:58
    
@AlBouazizi Top will by default sort processes (the list below the banner bar) by CPU hitting M (i.e. Shift-m) will resort the list by memory usage. –  crasic Apr 13 '11 at 18:08
    
thank you for your detailed answers, i learn new things.. but still don't know the 31GB of used by which program/process.. Thank you again –  AlBouazizi Apr 14 '11 at 5:26
    
@AlBouazizi what is the program that is at the top of the page when you sort by memory usage? –  crasic Apr 14 '11 at 5:44

Expanding on previous suggestions. Hopes this helps you and others.

In no particular order:

  1. htop; htop allows you to scroll through the entire list of processes, so that will show you every process and the amount of memory it is using

  2. ps; capture the output of ps to a text file you can view with cat, less, or any editor

for example

ps -ef > process-listing

(or the ps command options of your choice; see risyasin's suggestion above)

share|improve this answer

I'll add to crasic's response (not enough rep to comment) that if you run top, then press "z" key then "x" key top will highlight the sorted column (descending order). Then, you can then use '<' and '>' to change the sorted column (to switch between %cpu and %mem for example). hth

share|improve this answer

This will ouput pmem & rss longs of processes, worth to try.

ps -eo pid,pmem,rss,comm --sort rss
share|improve this answer
    
Risyasin, i tried your command but did not help with what i'm looking. i have 31GB of used memory. I need to know who used this memory. Thank you any how. –  AlBouazizi Apr 14 '11 at 5:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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