1

I'm not getting the same results when using apt search and apt-cache search: using apt, I'm getting a lot less results than using apt-cache. For example, searching for screenshot gets me 4 results with apt and 62 results with apt-cache. Moreover, apt-cache lists results which do not mention screenshot in the name or short description. Grepping for screenshot in the apt-cache search results filters the results to 12!

It seems apt is only searching package's name while apt-cache is searching the package's name and long description. But in this case, looking for a screenshot tool, the best result I get is the grepped apt-cache search!

I like using apt search as it is more convenient, but is there a way to make it behaves like apt-cache. Also is there a way to make apt-cache search only the package name and short description?

  • I get very different results! With both apt search screenshot and apt-cache search screenshot, I get 12 results of which 8 don't have screenshot in the package name itself. Have you enabled the Universe repository? I have. I'm on 16.04. – DK Bose Mar 29 '17 at 15:39
  • These are the packages: gnome-screenshot, gkrellshoot, gtk-vector-screenshot, kazam, kde-spectacle, kgrab, screenfetch, screengrab, screenie-qt, shutter, videocut, xfce4-screenshooter – DK Bose Mar 29 '17 at 15:43
  • Actually the initial results I got were from a Linux Mint box, I just realised I should've asked in another forum! Doing the same test on a Ubuntu Mate 16.04 with universe repo enabled, I get 62 results from apt-cache search as in my mint box, and I also get 62 results with apt search, only differently formatted. Still I do not get the 12 results I would like, and that you obtained...! – jazzmax Mar 30 '17 at 14:48
0

Looks like you cannot filter apt-cache search but I have found a way that could function similar to what you want.
Type sudo nano .bashrc and add the line alias apt-search='apt-cache search' to the end of the file. There are few limitations though:
1. You cannot use sudo before typing apt-search in the command line. It will tell you command not found
2. Can't override the apt search name. Bash will not allow it.

This will be applied when you logout and log back in. Hope this helped.

  • I did thought about using aliases, but was hoping for another way, like maybe a config file or command line switches... thanks anyway! – jazzmax Mar 30 '17 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.