strings
strings [-afov ] [-min-len] [-n min-len] [--bytes=min-len]
-t radix] [--radix=radix] [-e encoding] [--encoding=encoding
-] [--all] [--print-file-name] [--target=bfdname] [--help]
[--version] [file …
Outputs printable character sequences that are at least min-len long (default 4) followed by an unprintable character.
For object modules (i.e. load modules), prints the strings from initialized and loaded sections by default.
Useful for determining the contents of non-text files.
-min-len |
Example to show most frequently occuring strings:
strings file | sort | uniq -c | sort -nd | more
Show most frequentl words in a text file.
tr ' ' '\000' < file | strings | sort | uniq -c | sort -nr | more
SEE
ar, nm, objdump, ranlib, readelf
Looks for ASCII strings in a binary file or standard input, for identifying random object files etc.
A string is any sequence of 4 (default) or more printable characters
With the
The algorithm for identifying strings is extremely primitive.
binutils-2.14.90.0.4 2006-01-11 STRINGS(1)
( translate spaces to NULL to cause Mac Os
strings [ - ] [ -a ] [ -o ] [ -t d|o|x ] [ - ] [ -n number ] [--] [file … ]
- flag looks in all sections of the object files except __TEXT,__text.
section.
file may be of the form 'libx.a(foo.o)',
information about only that object file and not the entire library.
-a all sections of the object file (including the __TEXT,__text section.
- all bytes of the files (default for non-object files.
-- following arguments are files.
-o Preceded each string by its offset in the file (in decimal).
-t d|o|x
preceded string by its byte offset from the start of the file.
-number
-n minlen minimum string length default 4. a positive decimal integer.
-arch all|arch_type architecture, arch_type, of file (See arch(3) for the know arch_types.)
OS X uses Xcode and needs "active developer path" see Xcode