On 06/02/2014 14:06, Tino Sino wrote:
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?

Personaly, I use this:

  aptitude search ~i\!~M --disable-columns -F "%p" > aptitude-packages.txt

options:
 ~i   : "installed packages"
 \!~M : "not automatically installed", in combination with ~i this means
        you'll get a list of packages names you asked to
        =aptitude install ...= explicitly (and not their respective
        dependencies)
-F "%p" : format output to print only column of (untruncated) packages
          names
--disable-columns : disable trailing padd of white-spaces at the end of
                    lines (in my opinion, this should be better handled
                    by aptitude, i.e., no padding when only one column
                    is to be displayed, etc.)

Then restore packages this way:

  aptitude install $(cat aptitude-packages.txt)


Why do I use this?

Aptitude stores a flag for packages that were automatically
installed.  This is handy since the packages list you have to preserve
is really shorter than the whole installed packages list.  It makes
this list human readable and editable.

Nicolas


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/52f3936a.8030...@yahoo.fr

Reply via email to