How to Check Memory Usage of Processes on Linux

One of the basic task you can do on your computer or server is to check how much memory or RAM (Random Access Memory) each of the process is using. RAM or memory of your computer or server is limited so monitoring memory usage becomes important factor to keep your system running smooth and shiny.

memory usage by process

In linux

Checking Memory Usage Using <b>ps</b> Command

You can check memory consumption (in percentage) of all the process running on your Linux operating system with the following command:

ps -o pid,user,%mem,command ax | sort -b -k3 -r

This process will list all the processes with memory usage with percentage in descending order. The processes using most of the memory will be listed first.

You can explore more options of ps command here http://man7.org/linux/man-pages/man1/ps.1.html

Checking Memory Usage of a process

You can check memory usage of a process or a set of processes with <strong>pmap</strong> command. All you need is to mention the PID or IDs of the processes you want to check memory usage of (in KBs). As following:

sudo pmap 2322

It will list all the child process, libraries and other files of the main process with their corresponding process IDs. At the bottom it will show total usage in Kilobytes.

If you don’t want to list child process or libraries of the main process you can add famous tail parameter to the command so it shows only the last line. As following:

sudo pmap 2322 | tail -n 1

As mentioned earlier pmap accepts multiple PIDs. As following:

sudo pmap 2322 2174 | grep total

You can explore more options of pmap command here http://man7.org/linux/man-pages/man1/pmap.1.html

In Windows

In windows you can open Windows Task Manager

  • Press Ctrl + Alt + Delete and click the Task Manager option.
  • Press Ctrl + Shift + Esc.
  • Click the Start menu, select Run, and type in taskmgr
  • Right click the taskbar and select the Task Manager option.

Checking Memory Consumption Using ps Command

coming soon

Read also: How to receive an email alert for disk usage on linux server

One thought on “How to Check Memory Usage of Processes on Linux

Leave a Reply