xref: /freebsd/contrib/elftoolchain/strings/strings.1 (revision 0fe0fe112fa6cc220f14a1a9196b51fdc79edc72)
1a85fe12eSEd Maste.\" Copyright (c) 2007 S.Sam Arun Raj
2a85fe12eSEd Maste.\" All rights reserved.
3a85fe12eSEd Maste.\"
4a85fe12eSEd Maste.\" Redistribution and use in source and binary forms, with or without
5a85fe12eSEd Maste.\" modification, are permitted provided that the following conditions
6a85fe12eSEd Maste.\" are met:
7a85fe12eSEd Maste.\" 1. Redistributions of source code must retain the above copyright
8a85fe12eSEd Maste.\"    notice, this list of conditions and the following disclaimer.
9a85fe12eSEd Maste.\" 2. Redistributions in binary form must reproduce the above copyright
10a85fe12eSEd Maste.\"    notice, this list of conditions and the following disclaimer in the
11a85fe12eSEd Maste.\"    documentation and/or other materials provided with the distribution.
12a85fe12eSEd Maste.\"
13a85fe12eSEd Maste.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14a85fe12eSEd Maste.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15a85fe12eSEd Maste.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16a85fe12eSEd Maste.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17a85fe12eSEd Maste.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18a85fe12eSEd Maste.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19a85fe12eSEd Maste.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20a85fe12eSEd Maste.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21a85fe12eSEd Maste.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22a85fe12eSEd Maste.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23a85fe12eSEd Maste.\" SUCH DAMAGE.
24a85fe12eSEd Maste.\"
25*839529caSEd Maste.\" $Id: strings.1 3360 2016-01-24 18:34:06Z jkoshy $
26a85fe12eSEd Maste.\"
27*839529caSEd Maste.Dd January 24, 2016
28a85fe12eSEd Maste.Dt STRINGS 1
29a85fe12eSEd Maste.Os
30a85fe12eSEd Maste.Sh NAME
31a85fe12eSEd Maste.Nm strings
32a85fe12eSEd Maste.Nd "print the strings of printable characters in files"
33a85fe12eSEd Maste.Sh SYNOPSIS
34a85fe12eSEd Maste.Nm
35a85fe12eSEd Maste.Op Fl a | Fl -all
36a85fe12eSEd Maste.Op Fl e Ar encoding | Fl -encoding= Ns Ar encoding
37a85fe12eSEd Maste.Op Fl f | Fl -print-file-name
38a85fe12eSEd Maste.Op Fl h | Fl -help
39a85fe12eSEd Maste.Op Fl n Ar number | Fl -bytes= Ns Ar number | Fl Ar number
40a85fe12eSEd Maste.Op Fl o
41a85fe12eSEd Maste.Op Fl t Ar radix | Fl -radix= Ns Ar radix
42a85fe12eSEd Maste.Op Fl v | Fl -version
43a85fe12eSEd Maste.Op Ar
44a85fe12eSEd Maste.Sh DESCRIPTION
45a85fe12eSEd MasteFor each
46a85fe12eSEd Maste.Ar file
47a85fe12eSEd Mastespecified, the
48a85fe12eSEd Maste.Nm
49a85fe12eSEd Masteutility prints contiguous sequences of printable
50a85fe12eSEd Mastecharacters that are at least
51a85fe12eSEd Maste.Va n
52a85fe12eSEd Mastecharacters long and are followed by an unprintable character.
53a85fe12eSEd MasteThe default value of
54a85fe12eSEd Maste.Va n
55a85fe12eSEd Masteis 4.
56a85fe12eSEd MasteBy default, the
57a85fe12eSEd Maste.Nm
58a85fe12eSEd Masteutility only scans the initialized and loaded sections of ELF objects;
59a85fe12eSEd Mastefor other file types, the entire file is scanned.
60a85fe12eSEd MasteThe
61a85fe12eSEd Maste.Nm
62a85fe12eSEd Masteutility is mainly used for determining the contents of non-text files.
63a85fe12eSEd Maste.Pp
64a85fe12eSEd MasteIf no file name is specified as an argument, standard input is read.
65a85fe12eSEd Maste.Pp
66a85fe12eSEd MasteThe following options are available:
67a85fe12eSEd Maste.Bl -tag -width indent
68a85fe12eSEd Maste.It Fl a | Fl -all
69a85fe12eSEd MasteFor ELF objects, scan the entire file for printable strings.
70a85fe12eSEd Maste.It Fl e Ar encoding | Fl -encoding= Ns Ar encoding
71a85fe12eSEd MasteSelect the character encoding to be used while searching for strings.
72a85fe12eSEd MasteValid values for argument
73a85fe12eSEd Maste.Ar encoding
74a85fe12eSEd Masteare:
75a85fe12eSEd Maste.Bl -tag -width indent -compact
76a85fe12eSEd Maste.It Ar s
77a85fe12eSEd Mastefor single 7-bit-byte characters (ASCII, ISO 8859).
78a85fe12eSEd Maste.It Ar S
79a85fe12eSEd Mastefor single 8-bit-byte characters.
80a85fe12eSEd Maste.It Ar l
81a85fe12eSEd Mastefor 16-bit little-endian.
82a85fe12eSEd Maste.It Ar b
83a85fe12eSEd Mastefor 16-bit big-endian.
84a85fe12eSEd Maste.It Ar L
85a85fe12eSEd Mastefor 32-bit little-endian.
86a85fe12eSEd Maste.It Ar B
87a85fe12eSEd Mastefor 32-bit big-endian.
88a85fe12eSEd Maste.El
89a85fe12eSEd MasteThe default is to assume that characters are encoded using a single
90a85fe12eSEd Maste7-bit byte.
91a85fe12eSEd Maste.It Fl f | Fl -print-file-name
92a85fe12eSEd MastePrint the name of the file before each string.
93a85fe12eSEd Maste.It Fl h | Fl -help
94a85fe12eSEd MastePrint a usage summary and exit.
95a85fe12eSEd Maste.It Xo
96a85fe12eSEd Maste.Fl n Ar number |
97a85fe12eSEd Maste.Fl -bytes= Ns Ar number |
98a85fe12eSEd Maste.Fl Ar number
99a85fe12eSEd Maste.Xc
100a85fe12eSEd MastePrint the contiguous character sequence of at least
101a85fe12eSEd Maste.Ar number
102a85fe12eSEd Mastecharacters long, instead of the default of 4 characters.
103*839529caSEd MasteArgument
104*839529caSEd Maste.Ar number
105*839529caSEd Masteshould specify a positive decimal integer.
106a85fe12eSEd Maste.It Fl o
107a85fe12eSEd MasteEquivalent to specifying
108a85fe12eSEd Maste.Fl t Ar o .
109a85fe12eSEd Maste.It Fl t Ar radix | Fl -radix= Ns Ar radix
110a85fe12eSEd MastePrint the offset from the start of the file before each string
111a85fe12eSEd Masteusing the specified radix.
112a85fe12eSEd MasteValid values for argument
113a85fe12eSEd Maste.Ar radix
114a85fe12eSEd Masteare:
115a85fe12eSEd Maste.Bl -tag -width indent -compact
116a85fe12eSEd Maste.It Ar d
117a85fe12eSEd Mastefor decimal
118a85fe12eSEd Maste.It Ar o
119a85fe12eSEd Mastefor octal
120a85fe12eSEd Maste.It Ar x
121a85fe12eSEd Mastefor hexadecimal
122a85fe12eSEd Maste.El
123a85fe12eSEd Maste.It Fl v | Fl -version
124a85fe12eSEd MasteDisplay a version identifier and exit.
125a85fe12eSEd Maste.El
126a85fe12eSEd Maste.Sh EXIT STATUS
127a85fe12eSEd Maste.Ex -std
128a85fe12eSEd Maste.Sh EXAMPLES
129a85fe12eSEd MasteTo display strings in
130a85fe12eSEd Maste.Pa /bin/ls
131a85fe12eSEd Masteuse:
132a85fe12eSEd Maste.Dl "$ strings /bin/ls"
133a85fe12eSEd Maste.Pp
134a85fe12eSEd MasteTo display strings in all sections of
135a85fe12eSEd Maste.Pa /bin/ln
136a85fe12eSEd Masteuse:
137a85fe12eSEd Maste.Dl "$ strings -a /bin/ln"
138a85fe12eSEd Maste.Pp
139a85fe12eSEd MasteTo display strings in all sections of
140a85fe12eSEd Maste.Pa /bin/cat
141a85fe12eSEd Masteprefixed with the filename and the offset within the file use:
142a85fe12eSEd Maste.Dl "$ strings -a -f -t x /bin/cat"
143a85fe12eSEd Maste.Sh SEE ALSO
144a85fe12eSEd Maste.Xr ar 1 ,
145a85fe12eSEd Maste.Xr nm 1 ,
146a85fe12eSEd Maste.Xr objdump 1 ,
147a85fe12eSEd Maste.Xr ranlib ,
148a85fe12eSEd Maste.Xr readelf 1 ,
149a85fe12eSEd Maste.Xr size 1
150a85fe12eSEd Maste.Sh HISTORY
151a85fe12eSEd MasteThe first FreeBSD
152a85fe12eSEd Maste.Nm
153a85fe12eSEd Masteutility appeared in
154a85fe12eSEd Maste.Fx v3.
155a85fe12eSEd MasteIt was later discontinued in
156a85fe12eSEd Maste.Fx v5 ,
157a85fe12eSEd Mastewhen i386-only a.out format was dropped in favor of ELF.
158a85fe12eSEd Maste.Sh AUTHORS
159a85fe12eSEd Maste.An -nosplit
160a85fe12eSEd MasteThe
161a85fe12eSEd Maste.Nm
162a85fe12eSEd Masteutility was re-written by
163b00fe64fSEd Maste.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .
164a85fe12eSEd MasteThis manual page was written by
165b00fe64fSEd Maste.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .
166