Handy CLI command to continuously monitor GPU usage for Nvidia users

Here is a handy command to have a continuously updating monitor of your current Nvidia GPU usage.

watch -d -n 0.5 nvidia-smi

Here, the -n 0.5 will have watch command run and display the result of nvidia-smi every 0.5 seconds in the same location of the terminal. -d will highlight the difference between two consecutive runs of nvidia-smi, or, to put it simply, whatever changed in the 0.5 seconds. Here is how it looks like:

Compare it with nvidia-smi -l 1, which would simply prints out another output, drowning the terminal with outputs and making it extremely hard to read. Here is how without watch the output will look like:

Credit: Unix&Linux Stack Exchange Answer


Great one, thanks!

1 Like