Package Detection with apt-file

Ola guys! I started to learn some Spanish and this is the reason I am greeting in Spanish. I hope you like it, because I am not here to share academic papers with you, right? I am here to make learn some Linux fun. The reason why you should stick with Unixmen is that you will get tons of info while I entertain you guys with my information. Entendido? Ok, ok… it is time for some Ubuntu knowledge.

Have you ever thought what package does your command run when you type it in the terminal? What is behind the ‘software-center’ command?

Figure 1

I did not know about that, until I learned about apt-file command. What is apt-file command? The apt-file is a command that will help you guys to figure out which package contains a certain command or any other file. As you read this article, ask yourself questions. For example, does this command comes pre-installed or not? If you want to learn a lot, you have to ask yourself a lot of questions and try to stay focused on the game.

We are playing with Ubuntu now, so open a new terminal and try to run the ‘apt-file‘ command like shown in Figure 2.

Figure 2

As you can see from Figure 2, the ‘apt-file‘ command is currently not installed. So, guys, what are you waiting for? For the sun to rise? Run that ‘apt-get‘ command and install ‘apt-file’. Hmm, ‘apt-get install apt-file’! Odd.

After the command is installed, you will be presented with the message shown below:

The system-wide cache is empty. You may want to run 'apt-file update' as root to update the cache. You can also run 'apt-file update' as normal user to use a cache in the user's home directory.

Figure 3

So run ‘sudo apt-file update‘ in your terminal and wait until the update is done. After you run update a strange screen will come up but do not worry because the cache is updating. And if something breaks or some errors come up, then what? If you think like this you will never learn, pray for more errors because you will learn new things. But this update does not give any errors guys, so relax and wait for it.

Figure 4

I am going to drink some apple juice now… oh, update is done. Ok, how do we use this command?

Simply use ‘apt-file search‘ command followed by the file or program you want to search for. Awesome! It works.

Figure 5

After I ran this I found that the list presented to me was quite long, but it’s ok. So let me know in the comments about your own experience with the ‘apt-file’ command.