strings

output the strings of printable characters .

strings [-afovi>] [-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

OS X

uses Xcode and needs "active developer path" see Xcode

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