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
11

NAME

13       strings — find printable strings in files
14

SYNOPSIS

16       strings [−a] [−t format] [−n number] [file...]
17

DESCRIPTION

19       The strings utility shall look for printable strings in  regular  files
20       and shall write those strings to standard output. A printable string is
21       any sequence of four (by default) or more printable  characters  termi‐
22       nated  by  a  <newline>  or  NUL  character. Additional implementation-
23       defined strings may be written; see localedef.
24
25       If the first argument is '−', the results are unspecified.
26

OPTIONS

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

OPERANDS

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

STDIN

59       See the INPUT FILES section.
60

INPUT FILES

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

ENVIRONMENT VARIABLES

66       The following environment  variables  shall  affect  the  execution  of
67       strings:
68
69       LANG      Provide  a  default  value for the internationalization vari‐
70                 ables that are unset or null. (See the Base Definitions  vol‐
71                 ume  of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
72                 ables for the precedence  of  internationalization  variables
73                 used to determine the values of locale categories.)
74
75       LC_ALL    If  set  to  a non-empty string value, override the values of
76                 all the other internationalization variables.
77
78       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
79                 bytes of text data as characters (for example, single-byte as
80                 opposed to  multi-byte  characters  in  arguments  and  input
81                 files) and to identify printable strings.
82
83       LC_MESSAGES
84                 Determine the locale that should be used to affect the format
85                 and contents  of  diagnostic  messages  written  to  standard
86                 error.
87
88       NLSPATH   Determine the location of message catalogs for the processing
89                 of LC_MESSAGES.
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           "%s", <string>
100
101       With the −t o option, the format of the output shall be:
102
103           "%o %s", <byte offset>, <string>
104
105       With the −t x option, the format of the output shall be:
106
107           "%x %s", <byte offset>, <string>
108
109       With the −t d option, the format of the output shall be:
110
111           "%d %s", <byte offset>, <string>
112

STDERR

114       The standard error shall be used only for diagnostic messages.
115

OUTPUT FILES

117       None.
118

EXTENDED DESCRIPTION

120       None.
121

EXIT STATUS

123       The following exit values shall be returned:
124
125        0    Successful completion.
126
127       >0    An error occurred.
128

CONSEQUENCES OF ERRORS

130       Default.
131
132       The following sections are informative.
133

APPLICATION USAGE

135       By default the data area (as opposed to the text,  ``bss'',  or  header
136       areas) of a binary executable file is scanned. Implementations document
137       which areas are scanned.
138
139       Some historical implementations do not require NUL or <newline>  termi‐
140       nators  for  strings to permit those languages that do not use NUL as a
141       string terminator to have their strings written.
142

EXAMPLES

144       None.
145

RATIONALE

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

FUTURE DIRECTIONS

166       None.
167

SEE ALSO

169       localedef, nm
170
171       The Base Definitions volume of  POSIX.1‐2008,  Chapter  8,  Environment
172       Variables, Section 12.2, Utility Syntax Guidelines
173
175       Portions  of  this text are reprinted and reproduced in electronic form
176       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
177       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
178       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
179       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
180       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
181       event of any discrepancy between this version and the original IEEE and
182       The Open Group Standard, the original IEEE and The Open Group  Standard
183       is  the  referee document. The original Standard can be obtained online
184       at http://www.unix.org/online.html .
185
186       Any typographical or formatting errors that appear  in  this  page  are
187       most likely to have been introduced during the conversion of the source
188       files to man page format. To report such errors,  see  https://www.ker
189       nel.org/doc/man-pages/reporting_bugs.html .
190
191
192
193IEEE/The Open Group                  2013                          STRINGS(1P)
Impressum