Package Detection with apt-file

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.

  • UnhappyGhost

    Hey Oltjano,
    Am a great fan of unixmen and the authors here. Love all your posts and have been learning lots of stuff from here.
    Straight to the point, I have been motivating people and helping them shift from Windows to Linux but the most important thing that keeps them from using Linux is their fear of remembering and using commands. So, here is my little effort that i started. I have written a Script (in bash) that will help users accomplish their tasks easily without the need to remember the commands, just by using the numeric keystrokes.

    Here is a pre-release copy for you to review and share with your team on unixmen and if you guys feel that this could do any good to the linux newbie users, then do leave me an email on unhappyghost[at]unhappyghost[dot]com

    Screenshot of this attached

    Download it here :


  • Héctor Raúl Ramírez Sanguinett

    Greeting in spanish is Hola. The H in spanish is mute but not invisible…

    apt-file is a GREAT utility! Your article makes it crystal clear. Kudos, Oltjano.

  • Chris Jones

    Hello UnhappyGhost. If you have anything you’d like Unixmen to review, please email me at

  • debexpert

    Good stuff mate. If you want to speak Spanish come to Twitter ;) Hablamos en castellano también. @JollaES es la comunidad no oficial española de soporte a SailfishOS de Jolla

  • Etherless

    This is similar to the command “apt-cache search command_name” ?
    Saludos desde España

  • Ambition

    Thank you very much Hector :) You Spanish ?

  • Ambition

    Thank you very much debexpert :) Yes i love spanish. I will add you in twitter now. Thank you very much for liking the article.

  • Ambition

    Thank you very much for loving my posts and i am happy that you wrote a script to help newbies. I will check your script and send you an email about it. Maybe i write an article, who knows :)

  • UnhappyGhost

    Great!! please find the permanent link to this script here on this link
    This script will be announced to public on 31st of this month but you can directly grab the copy of the script right away on the page link mentioned above!!

  • Héctor Raúl Ramírez Sanguinett

    Of course que sí. Also some spanglish too… Any help I can give you is yours for the asking.