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