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
24       If the first argument is '-', the results are unspecified.
25

OPTIONS

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

OPERANDS

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

STDIN

58       See the INPUT FILES section.
59

INPUT FILES

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

ENVIRONMENT VARIABLES

65       The following environment  variables  shall  affect  the  execution  of
66       strings:
67
68       LANG      Provide  a  default  value for the internationalization vari‐
69                 ables that are unset or null. (See the Base Definitions  vol‐
70                 ume  of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
71                 ables for the precedence  of  internationalization  variables
72                 used to determine the values of locale categories.)
73
74       LC_ALL    If  set  to  a non-empty string value, override the values of
75                 all the other internationalization variables.
76
77       LC_CTYPE  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
80                 files) 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
85                 error.
86
87       NLSPATH   Determine the location of message catalogs for the processing
88                 of LC_MESSAGES.
89

ASYNCHRONOUS EVENTS

91       Default.
92

STDOUT

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

STDERR

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

OUTPUT FILES

120       None.
121

EXTENDED DESCRIPTION

123       None.
124

EXIT STATUS

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

CONSEQUENCES OF ERRORS

133       Default.
134
135       The following sections are informative.
136

APPLICATION USAGE

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

EXAMPLES

147       None.
148

RATIONALE

150       Apart from rationalizing the option syntax and slight difficulties with
151       object  and executable binary files, strings is specified to match his‐
152       torical practice closely. The -a and  -n  options  were  introduced  to
153       replace  the non-conforming - and -number options. These options are no
154       longer specified by POSIX.1‐2008 but may be present in some implementa‐
155       tions.
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
162       with od.
163
164       The ISO C standard function isprint() is  restricted  to  a  domain  of
165       unsigned char.  This volume of POSIX.1‐2017 requires implementations to
166       write strings as defined by the current locale.
167

FUTURE DIRECTIONS

169       None.
170

SEE ALSO

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