1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 1991-2021 Free Software Foundation, Inc.
4
5Permission is granted to copy, distribute and/or modify this document
6under the terms of the GNU Free Documentation License, Version 1.3
7or any later version published by the Free Software Foundation;
8with no Invariant Sections, with no Front-Cover Texts, and with no
9Back-Cover Texts.  A copy of the license is included in the
10section entitled "GNU Free Documentation License".
11 -->
12<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
13<head>
14<title>GNU Binary Utilities: strings</title>
15
16<meta name="description" content="GNU Binary Utilities: strings">
17<meta name="keywords" content="GNU Binary Utilities: strings">
18<meta name="resource-type" content="document">
19<meta name="distribution" content="global">
20<meta name="Generator" content="makeinfo">
21<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
22<link href="index.html#Top" rel="start" title="Top">
23<link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
24<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
25<link href="index.html#Top" rel="up" title="Top">
26<link href="strip.html#strip" rel="next" title="strip">
27<link href="size.html#size" rel="previous" title="size">
28<style type="text/css">
29<!--
30a.summary-letter {text-decoration: none}
31blockquote.smallquotation {font-size: smaller}
32div.display {margin-left: 3.2em}
33div.example {margin-left: 3.2em}
34div.indentedblock {margin-left: 3.2em}
35div.lisp {margin-left: 3.2em}
36div.smalldisplay {margin-left: 3.2em}
37div.smallexample {margin-left: 3.2em}
38div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
39div.smalllisp {margin-left: 3.2em}
40kbd {font-style:oblique}
41pre.display {font-family: inherit}
42pre.format {font-family: inherit}
43pre.menu-comment {font-family: serif}
44pre.menu-preformatted {font-family: serif}
45pre.smalldisplay {font-family: inherit; font-size: smaller}
46pre.smallexample {font-size: smaller}
47pre.smallformat {font-family: inherit; font-size: smaller}
48pre.smalllisp {font-size: smaller}
49span.nocodebreak {white-space:nowrap}
50span.nolinebreak {white-space:nowrap}
51span.roman {font-family:serif; font-weight:normal}
52span.sansserif {font-family:sans-serif; font-weight:normal}
53ul.no-bullet {list-style: none}
54-->
55</style>
56
57
58</head>
59
60<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
61<a name="strings"></a>
62<div class="header">
63<p>
64Next: <a href="strip.html#strip" accesskey="n" rel="next">strip</a>, Previous: <a href="size.html#size" accesskey="p" rel="previous">size</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
65</div>
66<hr>
67<a name="strings-1"></a>
68<h2 class="chapter">7 strings</h2>
69<a name="index-strings"></a>
70<a name="index-listings-strings"></a>
71<a name="index-printing-strings"></a>
72<a name="index-strings_002c-printing"></a>
73
74
75<div class="smallexample">
76<pre class="smallexample">strings [<samp>-afovV</samp>] [<samp>-</samp><var>min-len</var>]
77        [<samp>-n</samp> <var>min-len</var>] [<samp>--bytes=</samp><var>min-len</var>]
78        [<samp>-t</samp> <var>radix</var>] [<samp>--radix=</samp><var>radix</var>]
79        [<samp>-e</samp> <var>encoding</var>] [<samp>--encoding=</samp><var>encoding</var>]
80        [<samp>-</samp>] [<samp>--all</samp>] [<samp>--print-file-name</samp>]
81        [<samp>-T</samp> <var>bfdname</var>] [<samp>--target=</samp><var>bfdname</var>]
82        [<samp>-w</samp>] [<samp>--include-all-whitespace</samp>]
83        [<samp>-s</samp>] [<samp>--output-separator</samp><var>sep_string</var>]
84        [<samp>--help</samp>] [<samp>--version</samp>] <var>file</var>&hellip;
85</pre></div>
86
87
88<p>For each <var>file</var> given, <small>GNU</small> <code>strings</code> prints the
89printable character sequences that are at least 4 characters long (or
90the number given with the options below) and are followed by an
91unprintable character.
92</p>
93<p>Depending upon how the strings program was configured it will default
94to either displaying all the printable sequences that it can find in
95each file, or only those sequences that are in loadable, initialized
96data sections.  If the file type is unrecognizable, or if strings is
97reading from stdin then it will always display all of the printable
98sequences that it can find.
99</p>
100<p>For backwards compatibility any file that occurs after a command-line
101option of just <samp>-</samp> will also be scanned in full, regardless of
102the presence of any <samp>-d</samp> option.
103</p>
104<p><code>strings</code> is mainly useful for determining the contents of
105non-text files.
106</p>
107
108
109<dl compact="compact">
110<dt><code>-a</code></dt>
111<dt><code>--all</code></dt>
112<dt><code>-</code></dt>
113<dd><p>Scan the whole file, regardless of what sections it contains or
114whether those sections are loaded or initialized.  Normally this is
115the default behaviour, but strings can be configured so that the
116<samp>-d</samp> is the default instead.
117</p>
118<p>The <samp>-</samp> option is position dependent and forces strings to
119perform full scans of any file that is mentioned after the <samp>-</samp>
120on the command line, even if the <samp>-d</samp> option has been
121specified.
122</p>
123</dd>
124<dt><code>-d</code></dt>
125<dt><code>--data</code></dt>
126<dd><p>Only print strings from initialized, loaded data sections in the
127file.  This may reduce the amount of garbage in the output, but it
128also exposes the strings program to any security flaws that may be
129present in the BFD library used to scan and load sections.  Strings
130can be configured so that this option is the default behaviour.  In
131such cases the <samp>-a</samp> option can be used to avoid using the BFD
132library and instead just print all of the strings found in the file.
133</p>
134</dd>
135<dt><code>-f</code></dt>
136<dt><code>--print-file-name</code></dt>
137<dd><p>Print the name of the file before each string.
138</p>
139</dd>
140<dt><code>--help</code></dt>
141<dd><p>Print a summary of the program usage on the standard output and exit.
142</p>
143</dd>
144<dt><code>-<var>min-len</var></code></dt>
145<dt><code>-n <var>min-len</var></code></dt>
146<dt><code>--bytes=<var>min-len</var></code></dt>
147<dd><p>Print sequences of characters that are at least <var>min-len</var> characters
148long, instead of the default 4.
149</p>
150</dd>
151<dt><code>-o</code></dt>
152<dd><p>Like &lsquo;<samp>-t o</samp>&rsquo;.  Some other versions of <code>strings</code> have <samp>-o</samp>
153act like &lsquo;<samp>-t d</samp>&rsquo; instead.  Since we can not be compatible with both
154ways, we simply chose one.
155</p>
156</dd>
157<dt><code>-t <var>radix</var></code></dt>
158<dt><code>--radix=<var>radix</var></code></dt>
159<dd><p>Print the offset within the file before each string.  The single
160character argument specifies the radix of the offset&mdash;&lsquo;<samp>o</samp>&rsquo; for
161octal, &lsquo;<samp>x</samp>&rsquo; for hexadecimal, or &lsquo;<samp>d</samp>&rsquo; for decimal.
162</p>
163</dd>
164<dt><code>-e <var>encoding</var></code></dt>
165<dt><code>--encoding=<var>encoding</var></code></dt>
166<dd><p>Select the character encoding of the strings that are to be found.
167Possible values for <var>encoding</var> are: &lsquo;<samp>s</samp>&rsquo; = single-7-bit-byte
168characters (ASCII, ISO 8859, etc., default), &lsquo;<samp>S</samp>&rsquo; =
169single-8-bit-byte characters, &lsquo;<samp>b</samp>&rsquo; = 16-bit bigendian, &lsquo;<samp>l</samp>&rsquo; =
17016-bit littleendian, &lsquo;<samp>B</samp>&rsquo; = 32-bit bigendian, &lsquo;<samp>L</samp>&rsquo; = 32-bit
171littleendian.  Useful for finding wide character strings. (&lsquo;<samp>l</samp>&rsquo;
172and &lsquo;<samp>b</samp>&rsquo; apply to, for example, Unicode UTF-16/UCS-2 encodings).
173</p>
174</dd>
175<dt><code>-T <var>bfdname</var></code></dt>
176<dt><code>--target=<var>bfdname</var></code></dt>
177<dd><a name="index-object-code-format-3"></a>
178<p>Specify an object code format other than your system&rsquo;s default format.
179See <a href="Target-Selection.html#Target-Selection">Target Selection</a>, for more information.
180</p>
181</dd>
182<dt><code>-v</code></dt>
183<dt><code>-V</code></dt>
184<dt><code>--version</code></dt>
185<dd><p>Print the program version number on the standard output and exit.
186</p>
187</dd>
188<dt><code>-w</code></dt>
189<dt><code>--include-all-whitespace</code></dt>
190<dd><p>By default tab and space characters are included in the strings that
191are displayed, but other whitespace characters, such a newlines and
192carriage returns, are not.  The <samp>-w</samp> option changes this so
193that all whitespace characters are considered to be part of a string.
194</p>
195</dd>
196<dt><code>-s</code></dt>
197<dt><code>--output-separator</code></dt>
198<dd><p>By default, output strings are delimited by a new-line. This option
199allows you to supply any string to be used as the output record
200separator.  Useful with &ndash;include-all-whitespace where strings
201may contain new-lines internally.
202</p></dd>
203</dl>
204
205
206
207<hr>
208<div class="header">
209<p>
210Next: <a href="strip.html#strip" accesskey="n" rel="next">strip</a>, Previous: <a href="size.html#size" accesskey="p" rel="previous">size</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
211</div>
212
213
214
215</body>
216</html>
217