2

I'm uncertain of how "threads" work in this environment, and my first post was going to have to switch directions, as steeldriver pointed out that I probably want to look at gtk+ as a source of my misunderstanding, and truly, I'm there again. Let me ask a simple question this time. What am I to understand from the output from this command:

    $ dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]'
ii  libgtk-3-0:amd64             3.18.9-1ubuntu3.3         amd64        GTK+ graphical user interface library
ii  libgtk-3-bin                 3.18.9-1ubuntu3.3         amd64        programs for the GTK+ graphical user interface library
ii  libgtk-3-common              3.18.9-1ubuntu3.3         all          common files for the GTK+ graphical user interface library
ii  libgtk2-perl                 2:1.2498-1                amd64        Perl interface to the 2.x series of the Gimp Toolkit library
ii  libgtk2.0-0:amd64            2.24.30-1ubuntu1.16.04.2  amd64        GTK+ graphical user interface library
ii  libgtk2.0-bin                2.24.30-1ubuntu1.16.04.2  amd64        programs for the GTK+ graphical user interface library
ii  libgtk2.0-cil                2.12.10-6                 amd64        CLI binding for the GTK+ toolkit 2.12
ii  libgtk2.0-common             2.24.30-1ubuntu1.16.04.2  all          common files for the GTK+ graphical user interface library
$ 

Does my ubuntu system use any or all of these?

1
  • 1
    You'd originally posted this on our "Ask Ubuntu Meta" site, the place were we discuss how this site works, answer support questions etc. Only questions about the Ask Ubuntu site itself should be asked there. Questions about Ubuntu belong here, on the main site.
    – terdon
    Feb 8, 2018 at 10:25

1 Answer 1

1

That output shows the list of installe packages whose name starts with libgtk. All of those are installed. Whether or not they are actually needed (used) is something else again. An easy way of checking whether a package is needed is to run aptitude why on the package. For example, on my (very old) 14.04.5 LTS system:

$ aptitude why libgtk-3-0
i   firefox Depends libgtk-3-0 (>= 3.4)

You can automate this with:

$ dpkg -l libgtk* | grep '^i.*libgtk-*[0-9]' | awk '{print $2}' | xargs -I{} aptitude why {}
i   firefox Depends libgtk-3-0 (>= 3.4)
i   evince           Depends gnome-icon-theme (>= 2.17.1)
i A gnome-icon-theme Depends libgtk-3-bin                
i   firefox    Depends libgtk-3-0 (>= 3.4)        
i A libgtk-3-0 Depends libgtk-3-common (>= 3.10.8)
i   firefox Depends libgtk2.0-0 (>= 2.14)
i   firefox     Depends    libgtk2.0-0 (>= 2.14)
i A libgtk2.0-0 Recommends libgtk2.0-bin        
i   firefox     Depends libgtk2.0-0 (>= 2.14)
i A libgtk2.0-0 Depends libgtk2.0-common     

The awk just prints th 2nd field of each input line. The xargs tool then reads the input, and replaces the {} in the command you tell it to run (aptitude why, in this case) with whatever it read as input. So it will run aptitude why on each of the packages returned by dpkg. Oh, and I simplified your grep into a single call. You could simplify further by using awk alone:

$ dpkg -l libgtk* | awk '/^i.*libgtk-*[0-9]/{print $2}' 
libgtk-3-0:amd64
libgtk-3-bin
libgtk-3-common
libgtk2.0-0:amd64
libgtk2.0-bin
libgtk2.0-common
1
  • FYI: Aptitude is not default, even on 14.04. It may need installed separately by hand.
    – Thomas Ward
    Feb 8, 2018 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.