strings.html 9.3 KB

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