strings

output the strings of printable characters .

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
-n min-len
--bytes=min-len
sequences of characters must be are at least min-len characters long, default 4.
-f
--print-file-name
Output filename before each string.
-t radix
--radix=radix
Output the offset within the file before each string.
o for octal, x for hexadecimal, or d for decimal.
-o o radix. other versions of strings have -o use decminal
-a
--all
All bytes are scanned
-e encoding
--encoding=encoding
character encoding
  • s = single-7-bit-byte characters (ASCII, ISO 8859, etc., default)
  • S = single-8-bit-byte characters
  • b = 16-bit bigendian
  • B = 32-bit bigendian
  • L = 32-bit littleendian. Useful for finding wide character strings.
  • l = 16-bit littleendian, (unicode)
--target=bfdname Specify an object code format other than your system's default format.
-v, --version
--help

Example to show most frequently occuring strings:

strings file | sort | uniq -c | sort -nd | more

Show most frequentl words in a text file.
( translate spaces to NULL to cause to break up by words.

tr ' ' '\000' < file | strings | sort | uniq -c | sort -nr | more

SEE ar, nm, objdump, ranlib, readelf


Mac Os

strings [ - ] [ -a ] [ -o ] [ -t d|o|x ] [ - ] [ -n number ] [--] [file]

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 - 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.)

The algorithm for identifying strings is extremely primitive.

OS X uses Xcode and needs "active developer path" see Xcode

binutils-2.14.90.0.4 2006-01-11 STRINGS(1)