At the risk of making people angry, this answer works for linux and netbsd: $ file -L /proc/self/exe /proc/self/exe: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 8.99.2, not stripped