The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

strings - find printable strings in files

 SYNOPSIS



strings [-a][-t format][-n number][file...]

strings [-][-t format][-number][file...]

 DESCRIPTION

The strings utility looks for printable strings in regular files and writes those strings to standard output. A printable string is any sequence of four (by default) or more printable characters terminated by a newline or NUL character. Additional implementation-dependent strings may be written. (See localedef.)

 OPTIONS

The strings utility supports the XBD specification, Utility Syntax Guidelines  except that the obsolescent version uses "-" in a non-standard way and allows a multi-digit option, -number.

The following options are supported:

-a
-
Scan files in their entirety. If -a is not specified, it is implementation-dependent what portion of each file is scanned for strings.
-n number
-number
Specify the minimum string length, where the number argument is a positive decimal integer. The default is 4.
-t format
Write each string preceded by its byte offset from the start of the file. The format is dependent on the single character used as the format option-argument:
d
The offset will be written in decimal.
o
The offset will be written in octal.
x
The offset will be written in hexadecimal.

 OPERANDS

The following operand is supported:
file
A pathname of a regular file to be used as input. If no file operand is specified, the strings utility will read from the standard input.

 STDIN

See the INPUT FILES section.

 INPUT FILES

The input files named by the utility arguments or the standard input must be regular files of any format.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of strings:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files) and to identify printable strings.
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

Strings found are written to the standard output, one per line.

When the -t option is not specified, the format of the output is:

"%s", <string>

With the -t o option, the format of the output is:

"%o %s", <byte offset>, <string>

With the -t x option, the format of the output is:

"%x %s", <byte offset>, <string>

With the -t d option, the format of the output is:

"%d %s", <byte offset>, <string>

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

By default the data area (as opposed to the text, "bss" or header areas) of a binary executable file is scanned. Implementations will document which areas are scanned.

Some historical implementations do not require NUL or newline character terminators for strings to permit those languages that do not use NUL as a string terminator to have their strings written.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

nm.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]