Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an easy way to print the GTK and QT versions installed on a system? I am wanting to make a script that will print the version numbers of various developer tools and libraries.

share|improve this question
up vote 1 down vote accepted

Ask pkg-config.

$ pkg-config --modversion gtk+-2.0
share|improve this answer
It would be good that it also handle if libraries aren't installed. – Braiam Jul 6 '13 at 23:50
Using pkg-config on a non-existent .pc file results in a non-zero return code. – Ignacio Vazquez-Abrams Jul 6 '13 at 23:51
I am writing the code like this (pkg-config --modversion gtk+-3.0 2>/dev/null || echo "GTK3 is not installed") – Devyn Collier Johnson Jul 6 '13 at 23:52
@IgnacioVazquez-Abrams, thanks. This command is excellent. – Devyn Collier Johnson Jul 6 '13 at 23:52
If you're only testing for presence and not the specific version then you don't need to pass --modversion. – Ignacio Vazquez-Abrams Jul 6 '13 at 23:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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