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

Re: Get list of installed packages



On 02/06/2014 08:17 AM, iijima yoshino wrote:
> 于 Thu, 06 Feb 2014 14:06:44 +0100
> Tino Sino <robottinosino@gmail.com> 写道:
>
>> It has been asked before, but with different answers, e.g.:
>> 1) dpkg-query --list | awk '/^ii +/ { print $2; }'
>> 2) dpkg --get-selections | cut -f 1
>> 3) ... etc ...
>> Given that the output is the same:
>> $ diff \
>>         <(dpkg --get-selections | cut -f 1) \
>>         <(dpkg-query --list | awk '/^ii +/ { print $2; }') \
>>    && echo same-output
>> same-output
>> I wonder, what's the golden way to do this and why?
>>
>>
> dpkg -l 
> It's simple.
> Nothing is really "golden" or "best", I think.
>
>
because to use the package list for an install/reinstall you need to use
set-selections, like this:
   --set-selections
              Set package selections using file read from stdin. This 
file  should
              be  in  the  format  'package  state', where state is one
of install,
              hold, deinstall or purge. Blank lines  and  comment 
lines  beginning
              with '#' are also permitted.



-- 
Paul Cartwright
Registered Linux User #367800 and new counter #561587


Reply to: