6

I have a list of packages and I want to know which packages are not available in the ubuntu repositories.

I type this command but it returns nothing :

$ apt-cache show vim TotO perl 2>&1 | grep "Unable to locate package"
$

It occurs in both Ubuntu 16.04 LTS and 18.04 LTS.

Can you help ?

  • What is the output of the apt-cache without grep ? Are there any "Unable to locate package" lines at all ? – Soren A Oct 10 at 13:50
  • See unix.stackexchange.com/a/202041/57134 . – N0rbert Oct 10 at 13:50
  • @SorenA N: Unable to locate package tOTo – SebMa Oct 10 at 13:57
  • @WilliamMartens It's unrelated because my grep search pattern doesn't start by a - The N0rbert's solution works fine. – SebMa Oct 10 at 14:04
6

As per apt-cache man-page

-q, --quiet
Quiet; produces output suitable for logging, omitting progress indicators. More q's will produce more quietness up to a maximum of 2. You can also use -q=# to set the quietness level, overriding the configuration file. Configuration Item: quiet.

you have to pass --quiet=0 to use apt-cache in scripts.

Use code below:

apt-cache --quiet=0 show vim TotO perl 2>&1 | grep "Unable to locate package"

or

apt-cache -q0 show vim TotO perl 2>&1 | grep "Unable to locate package"
| improve this answer | |

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.