2018-11-15 14:21:52 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: intermediate
|
2018-11-16 12:47:48 +00:00
|
|
|
category-title: Intermediate commands
|
2018-11-15 14:21:52 +00:00
|
|
|
tags: strings read binaries file
|
|
|
|
author: Marco Farace
|
2018-11-16 19:47:01 +00:00
|
|
|
title: strings
|
2018-11-18 20:38:56 +00:00
|
|
|
previous-page: pages/cmd/interm//ssh.html
|
|
|
|
next-page: pages/cmd/interm//sync.html
|
2018-11-15 14:21:52 +00:00
|
|
|
---
|
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
The strings command returns each string of printable characters (ASCII)
|
|
|
|
in files. Its main uses are to determine the contents of and to extract text
|
|
|
|
from binary files (i.e., non-text files). From the Shell manual: "find the
|
|
|
|
printable strings in a object, or other binary, file".<br>
|
|
|
|
|
|
|
|
Strings can be used to extract character information and string of a given lenght
|
|
|
|
from text file(s). When used without any options, strings displays all strings
|
|
|
|
that are at least four characters in length in the files whose names are
|
|
|
|
supplied as arguments (i.e., input data). Strings that are on separate lines
|
|
|
|
in the input files are shown on separate lines on the screen, and an attempt
|
|
|
|
is made to display all strings found on a single line in a file on a single
|
|
|
|
line on the screen (although there may be a carryover to subsequent lines in
|
|
|
|
the event that numerous strings are found on a single line). strings looks in
|
|
|
|
all sections of the object files except the (__TEXT,__text) section.<br>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
strings [options] file_name(s)
|
|
|
|
</pre>
|
2018-11-15 14:21:52 +00:00
|
|
|
|
|
|
|
<h3> Flags <h3>
|
2018-11-15 20:09:21 +00:00
|
|
|
<ul>
|
|
|
|
<li>-n: Specify the minimum string length, where the number argument is
|
|
|
|
a positive decimal integer. The default is 4.</li>
|
2018-11-15 14:29:50 +00:00
|
|
|
<li>-: This option causes strings to look for strings in all bytes of
|
2018-11-15 20:09:21 +00:00
|
|
|
the files (the default for non-object files).</li>
|
2018-11-15 14:29:50 +00:00
|
|
|
<li>--: This option causes strings to treat all the following arguments
|
2018-11-15 20:09:21 +00:00
|
|
|
as files.</li>
|
2018-11-15 14:29:50 +00:00
|
|
|
<li>-a: This option causes strings to look for strings in all sections
|
2018-11-15 20:09:21 +00:00
|
|
|
of the object file (including the (__TEXT,__text) section.</li>
|
|
|
|
</ul>
|