2 Responses to How to find out my libc (glibc) version?

If you use dpkg, this will display a one-line summary of the libc *package* that you’re using: dpkg-query -l libc6 — tip: this usage allows several patterns and globbing such as dpkg-query -l '*libc[^a-z]' '*libc'

Also with dpkg-query, a long report with more details: dpkg-query -s libc6

And then dpkg-query -W -f=... ... allows some custom formatting of desired details, although, the format codes are a bit tough to figure out, not well documented in the manual page. For the details, refer to the source.

If you (also) use aptitude, this will display a long report similar to (maybe the same as) dpkg -s (but as opposed to dpkg-query it needs a direct match for a package name, no globbing): aptitude show libc6

And then, to get back to the original article, sometimes there is no file matching /lib/libc.* (depending on the distro in use). But the proper use case of ldd helps here: given any dynamic executable that links to libc.so.6 (and as good as all dynamic executables do), specifying that executable’s name to ldd will cause ldd to display all the pathes to which the references *actually* will be resolved. Then, you can use that path to do as the article advises: execute the library file itself so that its stub displays its version information.

(Notably, the package details as well as the version information from the libc executable itself also indicate whether a derivative libc is in use; for instance, eglibc has a version number alike to the original glibc, but seems to be independently maintained nowadays.)