I installed CUDA using the official .deb form the NVIDIA homepage. But I ran into some trubles and wanted to redo the installation to ensure that every step along the way worked as expected.

Thus I 'apt-get purge cuda...'

But now I still have nvcc which confuses me as I expected it to belong to the cuda package.

How do I figure out which package nvcc belongs to?


4 Answers 4


Check with apt-file because in your case nvcc is part of a package (nvidia-cuda-toolkit).

First you have to install apt-file

sudo apt-get install apt-file
sudo apt-file update

Now start

apt-file search nvcc


apt-file search --regex /nvcc$


apt-file search $(which nvcc)

To check why the package nvidia-cuda-toolkit was installed use aptitude.

sudo apt-get install aptitude
aptitude why nvidia-cuda-toolkit

The easiest way to do this is dpkg -S.

So, to find out which package zgrep is in, try:

$ dpkg -S `which zgrep`
gzip: /bin/zgrep

This shows it's in the package gzip.

Of course you can just use the path to the file, e.g.:

$ dpkg -S /usr/share/dict/words
diversion by dictionaries-common from: /usr/share/dict/words
diversion by dictionaries-common to: /usr/share/dict/words.pre-dictionaries-common
dictionaries-common, wamerican: /usr/share/dict/words

This incidentally shows a more complex example.


apt uses dpkg as back-end to install many apps, and for dpkg there is a /var/lib/dpkg/info directory , where there's many *.info files; these contain information on each and every file that came with a package.

Thus you can do grep -i --color 'nvcc' /var/lib/dpkg/info/*.list . That may generate a pretty large list, however, so to narrow it down we can use which utility.

which locates a particular binary/executable file. For instance,

xieerqi:$ grep $(which gnome-terminal) /var/lib/dpkg/info>

This tells grep to take full path to gnome-terminal executable, and find which package has installed it. In this case the package was gnome-terminal.

A not so obvious case would be nm-tool

xieerqi:$ grep $(which nm-tool) /var/lib/dpkg/info/*.list 

We thus know, it belongs to network-manager package


sudo apt-cache search nvcc


libnvvm2 - NVIDIA CUDA Compiler NVVM runtime library nvidia-cuda-toolkit - NVIDIA CUDA toolkit

apt-cache should already be installed on your system.

Not the answer you're looking for? Browse other questions tagged or ask your own question.