strings - find printable strings in files
strings [-a][-t format][-n number][file...] strings [-][-t format][-number][file...]
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.)
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.
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.
See the INPUT FILES section.
The input files named by the utility arguments or the standard input must be regular files of any format.
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 .
Default.
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>
Used only for diagnostic messages.
None.
None.
The following exit values are returned:
- 0
- Successful completion.
- >0
- An error occurred.
Default.
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.
None.
None.
nm.