Linux ram usage by process

How to find which processes are taking all the memory?

Under Linux, simply press M to sort by physical memory usage (RES column). Under *BSD, run top -o res or top -o size . But htop is a lot nicer and doesn’t even consume more memory than top (however it’s not part of the basic toolset so you might not have it installed).

@Steven How can we group process with same parent? Basically firefox shows up in multiple times may be as it spawns multiple child processes. Is it possible to get combined memory usage?

If you have it installed I like htop once launching it you can press f6 , down arrow (to MEM% ), enter to sort by memory.

In Solaris the command you would need is:

This will list all processes in order of descending process image size. Note that the latter is based on memory committed to the process by the OS, not its resident physical memory usage.

There are supposedly versions of «top» available for Solaris, but these are not part of the standard installation.

Once top starts, press F to switch to the sort field screen. Choose one of the fields listed by pressing the key listed on the left; you probably want N for MEM%

If you want MEM%, pressing ‘M’ does the same stated above. ‘c’ adds command line parameters to the process list, may be informative for your problem.

This command will identify the top memory consuming processes:

ps -A --sort -rss -o pid,pmem:40,cmd:500 | head -n 6 | tr -s " " ";z" 

Doesn’t work on Solaris 9: ps: illegal option — — ps: ort is an invalid non-numeric argument for -s option ps: illegal option — r ps: s is an invalid non-numeric argument for -s option ps: unknown output format: -o pmem:40 ps: unknown output format: -o cmd:500

Читайте также:  Linux convert image to webp

One nice alternative to top is htop . Check it, it is much more user friendly than regular top.

Globally: It’s always recommended to use a log analyser tool for logging history logs such as Splunk, ELK etc. So that using query language you can easily get the PIDs and its usage by CPU & memory.

AT SERVER/OS LEVEL: From inside top you can try the following:

 Press SHIFT+M ---> This will give you a process which takes more memory in descending order. 
$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -10 

This will give the top 10 processes by memory usage. Also you can use vmstat utility to find the RAM usage at same time not for history.

Источник

Оцените статью
Adblock
detector