Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

216 lines
9.2KB

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