The ps command on Linux systems is a default command line utility that can give us insight into the processes that are currently running. It can give us a lot of helpful information about these processes, including their PID (process ID), TTY, the user running a command or application, and more.
There are two columns in the output of the
ps command that don’t get talked about a lot. These are the VSZ (Virtual Memory Size) and RSS (Resident Set Size) columns. Both columns give us information about how much memory a process is using. In this guide, we’ll go over their meanings and how to interpret the data they show us in the
ps command on Linux.
In this tutorial you will learn:
- How to interpret VSZ and RSS numbers in the ps command output
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
VSZ and RSS
The VSZ and RSS columns appear in the
ps command output, as shown in the screenshot below. Values appear in kilobytes for every process that’s running on the system.
VSZ is Virtual Memory Size. This is the size of memory that Linux has given to a process, but it doesn’t necessarily mean that the process is using all of that memory. For example, many applications have functions to carry out certain tasks, but may not load them into memory until they are needed. Linux utilizes demand paging, which only loads pages into memory once the application makes an attempt to use them.
The VSZ size you see has taken all of these pages into consideration, but it doesn’t mean they’ve been loaded into physical memory. The VSZ size is therefore not usually an accurate measurement of how much memory a process is using, but rather an indication of the maximum amount of memory a process can use if it loads all of its functions and libraries into physical memory.
RSS is Resident Set Size. This is the size of memory that a process has currently used to load all of its pages. At first glance, it may seem like the RSS number is the real amount of physical memory that a system process is using. However, shared libraries are counted for each process, making the reported amount of physical memory usage less accurate.
Here’s an example. If you have two image editing programs on your Linux system, they likely utilize many of the same image processing libraries. If you open one of the applications, the necessary library will be loaded into RAM. When you open the second application, it will avoid reloading a duplicate copy of the library into RAM, and just share the same copy that the first application is using. For both applications, the RSS column would count the size of the shared library, even though it’s only been loaded once. This means that the RSS size is often an overestimate of the amount of physical memory that’s actually being used by a process.
If you’re trying to monitor the memory usage on your Linux system, there are more accurate methods than the RSS and VSZ numbers. Those columns are handy for certain purposes, but not when you just want a simple breakdown of memory usage on your system. See our guide on how to monitor RAM usage on Linux for better ways to do that.
In this guide, we learned about the VSZ and RSS columns from the output of the
ps command. Both of these columns cause confusion to newcomers, and aren’t easily explained without the help of examples. They offer us an important measurement of how much memory a process is using, but aren’t always accurate about how much physical memory is currently being used. To do that, we offer better suggestions in our other guide.