}

How to check video card memory RAM on linux

Created:

Introduction

Sometimes when you are connected to a computer or you are using a new machine it's neccesary to check how much memory has your video card. In this tutorial we will explain different ways to obtain the available memory of you VGA.

Variation 1: lspci from command line and grep

Just execute lspci and grep the VGA string:

lspci  -v -s  $(lspci | grep VGA | cut -d" " -f 1) | grep " prefetchable"

this will return the device slot in the first column as this output shows:

This will output the following:

        Memory at c0000000 (64-bit, prefetchable) [size=256M]

In our case we have 256M of video memory.

Alternative 2: Only for NVIDIA video cards

When you install Nvidia drivers it comes with the command nvidia-smi, which returns a lot of information from the video card:

nvidia-smi

The output is easy to read, we got the following output outout:

Tue Mar 14 17:30:50 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.26                 Driver Version: 375.26                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 660     On   | 0000:01:00.0     N/A |                  N/A |
| 30%   32C    P8    N/A /  N/A |   1059MiB /  1998MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+

As we can see the total memory is 2gb.