How to Check Memory Usage of Processes on Linux

So, 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. Because, RAM or memory of your computer or server is limited.

Linux

In linux

Checking Memory Usage Using ps Command

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

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 of a process or a set of processes with pmap 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:

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 dont 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:

As mentioned earlier pmap accepts multiple PIDs. As following:

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.

Leave a Reply

Your email address will not be published. Required fields are marked *