Package Detection with apt-file
Have you ever thought what package does your command run when you type it in the terminal? What is behind the ‘software-center’ command?
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.
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.
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.
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.
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.