How to find and install the missing file in Ubuntu

When you build some project, you may see the compile error such as:
“zlib.h : No such file or directory.”

Then you need to know which package include zlib.h to install by ‘apt-get’.
I show you how to find this. (Japanese version of this page)

Using apt-file command

At first, install apt-file command and prepare it.

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

To find zlib.h,

$ apt-file search zlib.h

It reports too many result. Let’s narrow down.

$ apt-file search /usr/include/zlib.h
zlib1g-dev: /usr/include/zlib.h

Now you know zlib.h is in zlib1g-dev package.

$ sudo apt-get install zlib1g-dev

Using ubuntu web service

Later, My friend told me there is much easier way.

Go to
Use the form of ‘Search the contents of packages’

Yes, it is easier. You don’t need any preparation.


“How to find and install the missing file in Ubuntu” at Android Building, Google Groups
How-To: Find missing packages with apt-file


About tetsu_koba

This entry was posted in Android. Bookmark the permalink.

9 Responses to How to find and install the missing file in Ubuntu

  1. Pingback: How to run velvet? « Bio Gist

  2. Priya says:

    Good solution…Thanks

  3. Raj says:

    Yep. That helped. Thanks

  4. Lenny says:

    Perfect !!!!

  5. Kuan says:

    It really helps me.

  6. Extremely helpful, thank you!

  7. Brian says:

    Teach a man to fish… Many thanks, sir.

  8. @ says:


  9. B. Doyle says:

    Thanks! This helped me install ds9 on Debian Jessie.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s