Check musl libc Version on Linux

Check musl libc Version on Linux

The musl libc is a lightweight implementation of the standard C library for Linux-based systems. When working with Linux distributions, especially minimal or container-optimized ones like Alpine, you may find musl libc instead of the more common glibc. Knowing which version of musl libc you're working with can be important for debugging, compatibility, or development purposes. This tutorial explains how to check musl libc version on Linux.

First, you need to find where the musl libc or its dynamic loader is installed. Use the find command:

sudo find / -iname '*musl*.so*'

This will search the system for shared objects that include musl in their name. The output will vary depending on the system and whether musl libc is the primary standard C library or just installed alongside glibc.

Example output on Ubuntu (with musl libc installed manually):

/usr/lib/ld-musl-x86_64.so.1

Example output on Alpine:

/lib/libc.musl-x86_64.so.1
/lib/ld-musl-x86_64.so.1

Once you've located a musl libc binary, you can invoke it directly to check the version:

/lib/libc.musl-x86_64.so.1

Example output:

musl libc (x86_64)
Version 1.2.5
Dynamic Program Loader
Usage: /lib/libc.musl-x86_64.so.1 [options] [--] pathname [args]

Leave a Comment

Cancel reply

Your email address will not be published.