How to discover the package a utility belongs to [duplicate]

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

or

apt-file search --regex /nvcc$

or

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.