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

NAME

6       strings - find printable strings in files
7

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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

OPERANDS

49       The following operand shall be supported:
50
51       file   A pathname of a regular file to be used as input. If no file op‐
52              erand is specified, the strings  utility  shall  read  from  the
53              standard input.
54
55

STDIN

57       See the INPUT FILES section.
58

INPUT FILES

60       The  input  files  named by the utility arguments or the standard input
61       shall be regular files of any format.
62

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

92       Default.
93

STDOUT

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

STDERR

118       The standard error shall be used only for diagnostic messages.
119

OUTPUT FILES

121       None.
122

EXTENDED DESCRIPTION

124       None.
125

EXIT STATUS

127       The following exit values shall be returned:
128
129        0     Successful completion.
130
131       >0     An error occurred.
132
133

CONSEQUENCES OF ERRORS

135       Default.
136
137       The following sections are informative.
138

APPLICATION USAGE

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

EXAMPLES

149       None.
150

RATIONALE

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

FUTURE DIRECTIONS

169       None.
170

SEE ALSO

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