1STRINGS(1P)                POSIX Programmer's Manual               STRINGS(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       strings - find printable strings in files
13

SYNOPSIS

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

DESCRIPTION

18       The strings utility shall look for printable strings in  regular  files
19       and shall write those strings to standard output. A printable string is
20       any sequence of four (by default) or more printable  characters  termi‐
21       nated  by  a  <newline>  or  NUL  character. Additional implementation-
22       defined strings may be written; see localedef.
23

OPTIONS

25       The strings utility shall conform to the  Base  Definitions  volume  of
26       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
27
28       The following options shall be supported:
29
30       -a     Scan  files  in  their  entirety.  If -a is not specified, it is
31              implementation-defined what portion of each file is scanned  for
32              strings.
33
34       -n  number
35              Specify  the minimum string length, where the number argument is
36              a positive decimal integer. The default shall be 4.
37
38       -t  format
39              Write each string preceded by its byte offset from the start  of
40              the  file. The format shall be dependent on the single character
41              used as the format option-argument:
42
43       d
44              The offset shall be written in decimal.
45
46       o
47              The offset shall be written in octal.
48
49       x
50              The offset shall be written in hexadecimal.
51
52
53

OPERANDS

55       The following operand shall be supported:
56
57       file   A pathname of a regular file to be used as input. If no file op‐
58              erand  is  specified,  the  strings  utility shall read from the
59              standard input.
60
61

STDIN

63       See the INPUT FILES section.
64

INPUT FILES

66       The input files named by the utility arguments or  the  standard  input
67       shall be regular files of any format.
68

ENVIRONMENT VARIABLES

70       The  following  environment  variables  shall  affect  the execution of
71       strings:
72
73       LANG   Provide a default value for the  internationalization  variables
74              that  are  unset  or  null.  (See the Base Definitions volume of
75              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
76              ables  for the precedence of internationalization variables used
77              to determine the values of locale categories.)
78
79       LC_ALL If set to a non-empty string value, override the values  of  all
80              the other internationalization variables.
81
82       LC_CTYPE
83              Determine  the  locale  for  the  interpretation of sequences of
84              bytes of text data as characters (for  example,  single-byte  as
85              opposed  to  multi-byte characters in arguments and input files)
86              and to identify printable strings.
87
88       LC_MESSAGES
89              Determine the locale that should be used to  affect  the  format
90              and contents of diagnostic messages written to standard error.
91
92       NLSPATH
93              Determine the location of message catalogs for the processing of
94              LC_MESSAGES .
95
96

ASYNCHRONOUS EVENTS

98       Default.
99

STDOUT

101       Strings found shall be written to the standard output, one per line.
102
103       When the -t option is not specified, the format of the output shall be:
104
105
106              "%s", <string>
107
108       With the -t o option, the format of the output shall be:
109
110
111              "%o %s", <byte offset>, <string>
112
113       With the -t x option, the format of the output shall be:
114
115
116              "%x %s", <byte offset>, <string>
117
118       With the -t d option, the format of the output shall be:
119
120
121              "%d %s", <byte offset>, <string>
122

STDERR

124       The standard error shall be used only for diagnostic messages.
125

OUTPUT FILES

127       None.
128

EXTENDED DESCRIPTION

130       None.
131

EXIT STATUS

133       The following exit values shall be returned:
134
135        0     Successful completion.
136
137       >0     An error occurred.
138
139

CONSEQUENCES OF ERRORS

141       Default.
142
143       The following sections are informative.
144

APPLICATION USAGE

146       By default the data area (as opposed to  the  text,  "bss",  or  header
147       areas)  of  a binary executable file is scanned.  Implementations docu‐
148       ment which areas are scanned.
149
150       Some historical implementations do not require NUL or <newline>  termi‐
151       nators  for  strings to permit those languages that do not use NUL as a
152       string terminator to have their strings written.
153

EXAMPLES

155       None.
156

RATIONALE

158       Apart from rationalizing the option syntax and slight difficulties with
159       object  and executable binary files, strings is specified to match his‐
160       torical practice closely. The -a and  -n  options  were  introduced  to
161       replace the non-conforming - and - number options.
162
163       The  -o  option historically means different things on different imple‐
164       mentations. Some use it to mean " offset in decimal", while others  use
165       it  as  " offset in octal". Instead of trying to decide which way would
166       be least objectionable, the -t option  was  added.  It  was  originally
167       named  -O to mean "offset", but was changed to -t to be consistent with
168       od.
169
170       The ISO C standard function isprint() is  restricted  to  a  domain  of
171       unsigned char. This volume of IEEE Std 1003.1-2001 requires implementa‐
172       tions to write strings as defined by the current locale.
173

FUTURE DIRECTIONS

175       None.
176

SEE ALSO

178       localedef, nm
179
181       Portions of this text are reprinted and reproduced in  electronic  form
182       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
183       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
184       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
185       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
186       event of any discrepancy between this version and the original IEEE and
187       The Open Group Standard, the original IEEE and The Open Group  Standard
188       is  the  referee document. The original Standard can be obtained online
189       at http://www.opengroup.org/unix/online.html .
190
191
192
193IEEE/The Open Group                  2003                          STRINGS(1P)
Impressum