On 3/13/17, Vincent Lefevre <vinc...@vinc17.net> wrote: > On 2017-03-13 00:23:54 -0400, kamaraju kusumanchi wrote: >> Let me rephrase my question. If "dpkg -l" cannot do it, is there some >> other command that will only show packages from the current >> repositories? > > Perhaps apt-show-versions, which can check whether a package > is in a repository. You will need options and/or grep. > > For instance, on one of my machines, I get in the output: > > unison2.40.102:amd64 2.40.102-3 installed: No available version in archive > > i.e. apt-show-versions detects that this package is installed, > but no longer in any declared repository.
Ooohhh, NICE find! I never would have thought about it because I've never seen apt-show-versions produce that output. I started to write: Is there a way to perform maybe a "reverse" grep sent to a file that was an "apt-show-versions -u" (or any other) query with everything EXCEPT those packages that return "No available version in archive"? And then I went to "man grep" = THERE IS A WAY!!!! At least it worked on my end. I don't have anything that's not from that one-liner repository I use (in /etc/apt/sources.list) so I tried: apt-show-versions | grep -v "uptodate" -i That "-v" is interchangeable with "--invert-match". Both allow you to: "Invert the sense of matching, to select non-matching lines" Better yet, I just did: apt-show-versions | grep -v "uptodate" -i > notUpToDate20170313 THAT... returned ONLY the lines that did NOT contain "uptodate" out of the tons of packages I have installed AND then sent that query to a file that is easier FOR ME to read and manipulate (versus seeing it on the terminal display). I A-SUME but cannot test drive that the following MIGHT be usable for someone somewhere... some day: apt-show-versions | grep -v "No available version in archive" -i > thePackagesIwanted OR, depending on your need, maybe something like: apt-show-versions -u | grep -v "No available version in archive" -i > thePackagesIwanted Yes, no, maybe so? For those who have not seen the ">" yet, that was a tremendous tip I learned on the fly years ago. It outputs what you're doing to a file. There's a no-brainer "caveat" to using that. You must have rights to access the directory that you're issuing that command from, else it WILL fail. E.g. I can't issue that command while my terminal is showing that I'm sitting in the /etc directory. It DOES work if I change the file path to "~/notUpToDate20170313", e.g.: elf@northpole:/etc$ apt-show-versions | grep -v "uptodate" -i > ~/notUpToDate20170313 I say again....... Oooohhhh :) Cindy :) -- Cindy-Sue Causey Talking Rock, Pickens County, Georgia, USA * runs with duct tape *