SCANELF(1)
πΈ NAME πΈ
okay so bestie, meet scanelf(1) β the user-space utility to scan ELF files. It's living in the pax-utils docs, and it's literally here to make your ELF life easier. π
β¨ SYNOPSIS β¨
scanelf [options] ELFs or directories
π¦ DESCRIPTION π¦
scanelf is a user-space utility that quickly scans the ELFs, directories, or common system paths you give it for different kinds of information. That can include ELF types, their PaX markings, TEXTRELs, etc... iykyk. It's giving main character energy for your binary inspection era. π
π OPTIONS π
-A,--archivesβ scans archives (.afiles). yes bestie, it does archives too.-a,--allβ prints all useful/simple info. the whole little info menu, periodt.-B,--nobannerβ don't display the header. no banner, no problem.-b,--bindβ prints symbol binding information (lazy or now). lowkey useful.-D,--endianβ prints ELF endianness (big/little/...). endian vibe check π-E,--etype ETYPEβ prints only ELF files matching the specified etype (likeET_DYN,ET_EXEC, etc...). filter that stack, bestie.-e,--headerβ printsGNU_STACKmarkings. iconic header info.-F,--format FORMATβ uses the specified format for output; see the FORMAT section for more information. custom output slay.-f,--from FILEβ reads input stream from the specified filename. feed it a file, fr fr.-g,--gmatchβ usesstrncmpto match libraries (use with-N). Or regexp with symbol matching. matching mode activated.-h,--helpβ shows condensed usage and exits. tiny help moment π«Ά-I,--osabiβ prints OSABI. get that ABI tea.-i,--interpβ prints the interpreter information (.interp/PT_INTERP). interpreter reveal β¨-k,--section SECTIONβ finds ELFs with the specified section. May be specified multiple times to match multiple sections simultaneously. See SECTION MATCHING for more info. section-hunting bestie.-L,--ldcacheβ utilizesld.so.cacheinformation (use with-r/-n). cache behavior, no cap.-l,--ldpathβ scans all directories in/etc/ld.so.conf. path-scanning era.-M,--bits BITSβ prints only ELF files matching the specified numeric bits (like 32/64). bits filter, cute.-m,--mountβ don't recursively cross mount points. stay in your lane, mount-wise.-N,--lib SONAMEβ finds ELFs that need the specified SONAME. May be specified multiple times to match multiple SONAMEs simultaneously. See SONAME MATCHING for more info. library-needs detective work π-n,--neededβ prints libraries the ELF is linked against (DT_NEEDED). dependency drama, printed.-O,--perms PERMSβ prints only ELF files with matching specified octal bits (like 755). perms filter, slay.-o,--file FILEβ writes output stream to the specified filename. redirect that output π-p,--pathβ scans all directories inPATHenvironment. yes, thatPATH.-q,--quietβ only outputs 'bad' things. quiet mode, but make it shady.-R,--recursiveβ scans directories recursively. go deeper, bestie.-r,--rpathβ prints runpaths encoded in the ELF (DT_RPATH/DT_RUNPATH). runpath reveal.-S,--sonameβ prints the ELF's shared library name (DT_SONAME). soname moment.-s,--symbol SYMBOLβ finds the specified symbol; see SYMBOL MATCHING for more info. symbol search, iconic.-T,--textrelsβ locates cause of TEXTRELs viaobjdump. detective mode, TEXTREL edition.-t,--textrelβ prints TEXTREL information. textrel tea β-V,--versionβ prints version and exits. version check, then bye.-v,--verboseβ be verbose (can be used more than once). more-v, more talking.-X,--fixβ tries and 'fixes' bad things (use with-r/-e). fix-it era, carefully.-x,--paxβ prints PaX markings. PaX info, periodt.-Y,--eabiβ prints EABI (only matters for a few architectures). niche but valid.-y,--symlinkβ don't scan symlinks. symlinks can sit this one out.-Z,--size SIZEβ prints ELF file size. size check, cute.-z,--setpax FLAGSβ setsEI_PAX/PT_PAX_FLAGSto specified flags (use with-Xx). flag-setting business.--use-ldpathβ uses theld.so.confpaths to find the full path to libraries (use in conjunction with--needed). path-finding assist.--root PATHβ searches the specified root tree instead of/. Generally paired with options like-lor-p. This implicitly treats all paths specified on the command line as relative to the root, so be sure to omit it if you are explicitly listing ELFs. root-tree energy, but read the warning bestie.--ldcache PATHβ uses the specified path instead of/etc/ld.so.cache. Generally paired with options like-Lor-n. custom cache path, no cap.
π FORMAT π
The format string is much like a printf string in that it is a literal string with flags requesting different information. For example, you could use a format string and expect the following results.
# scanelf -BF "file %f needs %n; funky time" /bin/bash
file bash needs libncurses.so.5,libdl.so.2,libc.so.6; funky time
Note that when you use a format string, generally information related flags should be omitted. In other words, you do not want to try and request NEEDED output (-n) and try to specify a format output at the same time as these operations are mutually exclusive. Each information related flag has an equivalent conversion specifier, so use those instead. You can of course continue to use non-information related flags (such as --verbose). π«Ά
There are three characters that introduce conversion specifiers.
%β replace with info#β silent boolean match+β verbose match
And there are a number of conversion specifiers. We try to match up the specifier with corresponding option. β¨
aβ machine (EM) typebβ bind flagseβ program headersDβ endianIβ osabiYβ eabiFβ long filenamefβ short filenameiβ interpkβ sectionMβ EI classNβ specified needednβ needed librariespβ filename (minus search)oβ etypeOβ permsrβ runpathsSβ SONAMEsβ symbolTβ all textrelstβ textrel statusxβ pax flags
π§ SYMBOL MATCHING π§
The string specified takes the form [%[modifiers]%][[+-]<symbol name>][,[.....]]. π
If the symbol name is empty, then all symbols are matched.
If the symbol name is a glob ("*"), then all symbols are dumped in a debug format. Do not rely on the structure of this output as it changes whenever we feel like it. fr fr, do not build on it.
If the first char of the symbol name is a plus ("+"), then only match defined symbols. If it's a minus ("-"), only match undefined symbols. When we say "defined", we mean the symbol is defined in the ELF vs having an external reference. yes bestie, that distinction matters.
Putting modifiers in between the percent signs ("%") allows for more in depth filters. There are groups of modifiers. If you don't specify a member of a group, then all types in that group are matched.
- STT group (symbol type)
nβ STT_NOTYPEoβ STT_OBJECTfβ STT_FUNCFβ STT_FILE
- STB group (symbol binding)
lβ STB_LOCALgβ STB_GLOBALwβ STB_WEAK
- STV group (symbol visibility)
pβ STV_DEFAULTiβ STV_INTERNALhβ STV_HIDDENPβ STV_PROTECTED
- SHN group (section header)
dβ defineduβ SHN_UNDEFaβ SHN_ABScβ SHN_COMMON
You can search for multiple symbols simultaneously by using a comma (,) to separate different searches. Every symbol that matches will be displayed while unmatched symbols will not. π
π₯ ELF ETYPES π₯
You can narrow your search by specifying the ELF object file type (ETYPE). The commandline option takes the numeric value and or symbolic type. Multiple values can be passed comma separated. Example -E ET_EXEC,ET_DYN,1. β¨
Here is the normal list available for your pleasure. You of course are free to specify any numeric value you want.
0β ET_NONE β unknown type1β ET_REL β relocatable file2β ET_EXEC β executable file3β ET_DYN β shared object4β ET_CORE β core file
π ELF BITS π
You can also narrow your search by specifying the ELF bitsize. Again, specify the numeric value or the symbolic define.
32β ELFCLASS32 β 32bit ELFs64β ELFCLASS64 β 64bit ELFs
π SECTION MATCHING π
A ! prefix will only show ELF's that do not have the specified section. not me using the ! to flip the vibe check.
π¦ NEEDED SONAME MATCHING π¦
A ! prefix will only show ELF's that do not depend on the specified library. same shady little ! energy.
π HOMEPAGE π
https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities
π REPORTING BUGS π
Please include as much information as possible (using any available debugging options) and send bug reports to the maintainers (see the AUTHORS section). Please use the Gentoo bugzilla at https://bugs.gentoo.org/ if possible. bestie, give them all the deets so they can actually help π«Ά
π SEE ALSO π
chpax(1), dumpelf(1), paxctl(1), pspax(1), readelf(1), scanelf(1), elf(5)
πΈ AUTHORS πΈ
- Ned Ludd
<solar@gentoo.org>β Maintainer - Mike Frysinger
<vapier@gentoo.org>β Maintainer - Fabian Groffen
<grobian@gentoo.org>β Mach-O Maintainer
π NOTES π
this iconic lil' page is from pax-utils 1.3.11, dated 08/02/2026, and yes bestie it's the scanelf(1) manual β mwah ππ
π¦ where this page comes from
- arch rolling: pax-utils 1.3.11-1 Β· GPL2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms