How to find missing packages in Ubuntu

Some times when you are going to install a package from third-parties on linux, you may see several errors about missing files or libraries. The best approach is to install apt-file then search the library name through the repository.

For example, I was going to install grid-pro on ubuntu-20.04, after I got the following error:

No. of missing libs (az) : 4
libXp.so.6
libXm.so.4
libncurses.so.5
libtinfo.so.5
IMPORTANT!!!!!!!
Please install the missing package(s).

In order to find the packages corresponding to the missing files,  first I installed apt-file and then update it to contains the information about the name of all files.

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

Now,  I can search the missing file, e.g :libncurses.so.5  like that:

apt-file search libncurses.so.5

The above command output is:

libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5
libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5.9

The package name is  libncurses5,  then i installed the package:

sudo apt-get install libncurses5

Hint: Sometimes apt-file does not returns the package name, then the package is not available, so it is better to send an email to the software producers.