Installing lists of packages from aptitude

Christian Schult cschult at gmx.de
Sun Dec 27 20:31:11 UTC 2009


Hello Dotan,

Dotan Cohen wrote:

> How can one install all the packages returned from an Aptitude search?
> For instance, all the KDE *-dbg packages? I see that these are
> available:
> 
> $ aptitude search dbg | grep kde
> i   kdeaccessibility-dbg            - debugging symbols for kdeaccessibility
> p   kdeadmin-dbg                    - debugging symbols for kdeadmin
> i   kdebase-dbg                     - debugging symbols for the KDE 4 base appli
> i A kdebase-runtime-dbg             - debugging symbols for KDE 4 base runtime m
> i   kdebase-workspace-dbg           - debugging symbols for the KDE 4 base works
> i   kdeedu-dbg                      - debugging symbols for the KDE 4 education
> p   kdegames-dbg                    - debugging symbols for the KDE games module
> i   kdegraphics-dbg                 - debugging symbols for the KDE 4 graphics m
> i   kdelibs-dbg                     - debugging symbols for kdelibs
> i   kdelibs5-dbg                    - debugging symbols for the KDE 4 libraries
> p   kdemultimedia-dbg               - debugging symbols for the KDE 4 multimedia
> p   kdenetwork-dbg                  - debugging symbols for the KDE 4 networking
> p   kdenlive-dbg                    - a non-linear video editor (debugging symbo
> p   kdepim-dbg                      - debugging symbols for kdepim
> p   kdepim-runtime-dbg              - debugging symbols for KDE 4 PIM runtime mo
> i A kdepimlibs-dbg                  - debugging symbols for the KDE 4 PIM librar
> i   kdeplasma-addons-dbg            - debugging symbols for kdeplasma-addons
> i   kdesdk-dbg                      - debugging symbols for the KDE 4 Software D
> p   kdesvn-dbg                      - debug symbols for kdesvn
> p   kdetoys-dbg                     - debugging symbols for kdetoys
> p   kdeutils-dbg                    - debugging symbols for the KDE 4 utilities
> p   kdevplatform-dbg                - debugging symbols for the KDevelop platfor
> p   kdewebdev-dbg                   - debugging symbols for the KDE 4 web develo
> p   kdewebdev-dbg-kde3              - debugging symbols for kdewebdev
> p   koffice-dbg-kde4                - debugging symbols for KOffice
> p   koffice-kde4-dbg                - debugging symbols for KOffice
> p   kxsldbg-kde3                    - graphical XSLT debugger for KDE
> p   liblockdev1-dbg                 - Debugging library for locking devices
> p   python-kde4-dbg                 - KDE 4 bindings for Python (debug extension
> 
> Now, which command will be "sudo apt-get install <a list of items in
> the second column>"?
> 
> Note that my goal here is not to get the debug packages installed, but
> rather to learn how to work with the output of Aptitude. Thanks in
> advance.

# on one line:
aptitude search "~n^kde.*-dbg$" | grep -v "^i" | cut -c4-36 | xargs echo aptitude install

Short explanation:
let aptitude search only package names (~n) which start with kde (^kde), then
any or no chars (.*), then end with -dbg (-dbg$); pipe output to grep which searches
for lines not beginning with i (grep -v "^i"); pipe output to cut wich
only prints from char #4 to #36; pipe that output to xargs which
collects the output and appends it to "echo aptitude install"

Remove "echo" to really install the packages.

Yes, my search is not the same as your search. You searched for
packages with "dbg" anywhere in it and with "kde" anywhere in it. My
search is a bit more precise to avoid matches like kxsldbg-kde3.

That's how i would do it on the quick. I'm sure there are many better
ways to achive the same goal.

Christian

-- 
 




More information about the ubuntu-users mailing list