Hot Summer Sale - up to 36% OFF

How to Check CUDA Version on Linux

How to Check CUDA Version on Linux
Published on Aug 14, 2025 Updated on Aug 14, 2025

The introduction of GPUs marked a significant turning point in the field of computing. GPUs substantially boost performance across numerous disciplines, not just in graphics rendering. They are optimized for parallel computing, enabling the massive acceleration of tasks and applications through thousands of cores designed to execute multiple concurrent tasks simultaneously. They have revolutionized gaming through realistic and visually rich images. Additionally, they play a crucial role in deep learning, AI, and other resource-intensive tasks thanks to their exceptional processing capabilities.

NVIDIA developed CUDA as an alternative to platforms such as OpenGL. It runs purely on NVIDIA GPUs and enables developers to harness its massive processing capabilities in developing general-purpose code

This tutorial presents various avenues of checking the CUDA version on Linux.

#Prerequisites

First, ensure that you have the following in place before beginning.

  • NVIDIA GPU on your PC

  • CUDA toolkit installed. Check out how to install CUDA on Ubuntu.

Deploy and scale your projects with Cherry Servers' cost-effective dedicated or virtual servers. Enjoy seamless scaling, pay-as-you-go pricing, and 24/7 expert support—all within a hassle-free cloud environment.

#How to Check CUDA Version on Linux

There are multiple ways of checking the version of CUDA on your system. Let’s check them out.

#Method 1: Using the nvcc command

NVCC, short for NVIDIA CUDA Compiler, is NVIDIA's compiler used to compile CUDA and C/C++ applications. You can easily leverage the nvcc command to check the CUDA version

Simply invoke the nvcc command as shown.

Command Line
nvcc --version

OR

Command Line
nvcc -V

The command prints the version of CUDA currently being used by your Linux system. It also includes the NVIDIA copyright information and build date of the CUDA compiler driver. The output reports that we are running CUDA 12.6.

check-cuda-version-with-nvcc-command

#Method 2: Using the apt package manager

The apt package manager (for Debian/Ubuntu users) is a decent tool for checking the CUDA version. To reveal the version, run:

Command Line
apt info cuda

On the output, you get attributes including CUDA's version, download, and installed size.

Alternatively, you can run the apt list command as follows.

Command Line
apt list --installed | grep cuda

This provides more comprehensive output that includes all the installed CUDA packages, toolkit, libraries, and documentation.

#Method 3: Using the dpkg package manager

If you prefer using the dpkg package manager, you can reveal CUDA's installed version as follows.

Command Line
dpkg -l | grep cuda-toolkit
Outputii  cuda-toolkit-12-6                     12.6.1-1          amd64      CUDA Toolkit 12.6 meta-package
ii  cuda-toolkit-12-6-config-common       12.6.68-1         all        Common config package for CUDA Toolkit 12.6.

#Method 4: Check CUDA version from Pytorch

If you are leveraging Pytorch, you can check CUDA version using just a few lines of code.

Command Line
import torch
print(torch.version.cuda)

check-cuda-version-using-torch

#Error when checking CUDA version

Have you, by any chance, encountered the nvcc is not installed! error? If yes, fret not. This is usually due to the $PATH variable for CUDA and its libraries not being defined.

To fix the matter, append the following lines in the ~/.bashrc file.

Command Line
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Save the changes and exit the file. Then apply the changes by running:

Command Line
source  ~/.bashrc

And that’s it. You should now check the CUDA version without running into any errors.

#Conclusion

We have outlined various methods for checking the CUDA version on your preferred Linux distribution. You have also learned how to debug the nvcc is not installed error, which is usually a result of CUDA not being installed or its $PATH variable not being specified.

Cloud VPS Hosting

Starting at just $3.24 / month, get virtual servers with top-tier performance.

Share this article

Related Articles

Published on Jun 7, 2021 Updated on Jun 29, 2022

AlmaLinux Review: a CentOS Clone Supported by CloudLinux

AlmaLinux is an open-source Linux distribution focused on long-term stability, that is a 1:1 binary compatible fork of Red Hat Enterprise Linux (RHEL)

Read More
Published on May 31, 2022 Updated on May 5, 2023

A Complete Guide to Linux Bash History

Learn how to work with Bash history to become more efficient with any modern *nix operating system.

Read More
Published on Jan 26, 2022 Updated on Jun 15, 2023

How to Use Cron to Automate Linux Jobs on Ubuntu 20.04

Learn how to use Cron - the most popular Linux workload automation tool that is widely used in Linux community - to automate Linux jobs on Ubuntu 20.04.

Read More
We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: fda3015ff.1337