[Next] [Previous] [Up] [Top] [Contents]

8.1 Working With Files

8.1.11 strings - find ASCII strings

To search a binary file for printable, ASCII, strings use the strings command. It searches for any sequence of 4 or more ASCII characters terminated by a <newline> or null character. I find this command useful for searching for file names and possible error messages within compiled programs that I don't have source code for.

Syntax

strings [options] file

Common Options

-n number use number as the minimum string length, rather than 4 (SVR4 only)

-number same as above

-t format precede the string with the byte offset from the start of the file, where format is one of: d = decimal, o = octal, x = hexadecimal (SVR4 only)

-o precede the string with the byte offset in decimal (BSD only)

Examples

% strings /bin/cut

SUNW_OST_OSCMD

no delimiter specified

invalid delimiter

b:c:d:f:ns

cut: -n may only be used with -b

cut: -d may only be used with -f

cut: -s may only be used with -f

no list specified

cut: cannot open %s

invalid range specifier

too many ranges specified

ranges must be increasing

invalid character in range

Internal error processing input

invalid multibyte character

unable to allocate enough memory

unable to allocate enough memory

cut:

usage: cut -b list [-n] [filename ...]

cut -c list [filename ...]

cut -f list [-d delim] [-s] [filename]


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]