[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: uninstalled packages in 'dpkg -l'



On Wed, 15 May 1996, Maarten Boekhold wrote:

> I always thought that 'dpkg -l' was supposed to show you all *installed*
> packages, but, when I do a: dpkg -l 'ncurses*' on my system, I get:
> 
> Desired=Unknown/Install/Remove/Purge
> | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
> |/ Err?=(none)/Hold/Reinst-required/X=bDesired=Unknown/Install/Remove/Purge
> | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
> |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
> ||/ Name            Version        Description
> +++-===============-==============-============================================
> un  ncurses         <unknown>      (no description available)
> [...remainder deleted...]
>
> Of these packages, all with a version of <unknown> are not installed, and
> I don't want these to show up either. They're confusing me.
> 
> What can I do about this?

pipe it through grep to get rid of the lines that you dont want.

$ dpkg -l 'ncurses*' | grep "^ii\|^Desired=Unknown\|^|\|+++"

Desired=Unknown/Install/Remove/Purge
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name            Version        Description
+++-===============-==============-============================================
ii  ncurses-base    1.9.9e-1       Video terminal manipulation: Minimum set of 
ii  ncurses-bin     1.9.9e-1       Video terminal manipulation: associated prog
ii  ncurses-term    1.9.9e-1       Video terminal manipulation: additional term
ii  ncurses3.0      1.9.9e-1       Video terminal manipulation: shared librarie
ii  ncurses3.0-dev  1.9.9e-1       Video terminal manipulation: Developer's lib
ii  ncurses3.0-pic  1.9.9e-1       Video terminal manipulation: Shared-library 

or just 'dpkg -l "ncurses*" | grep -v "<unknown>"' might do it, but this
would fail on packages which aren't "<unknown>" but which have failed to
install.


If you just want the installed packages, without the header info:

    dpkg -l "ncurses*" | grep "^ii"

If you do this a lot, write a shell alias (bash aliases can't handle
arguments, unfortunately), function or shell script to do it for you.

NOTE: be wary of shell functions (and aliases too)...even if you define
them in your ~/.bashrc so that they are available from the command
line, they will NOT be exutable to programs forked by the shell. e.g. a
function is not available in situations like 'find . -blahblah | xargs
myfunction". xargs will have no idea what "myfunction" is.  If you need
to be able to call it from another program then write a script.

Craig


Reply to: