1.\" Copyright (c) 1980, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)strings.1 6.11 (Berkeley) 05/09/91 7.\" 8.Dd 9.Dt STRINGS 1 10.Os BSD 3 11.Sh NAME 12.Nm strings 13.Nd find printable strings in a file 14.Sh SYNOPSIS 15.Nm strings 16.Op Fl afo 17.Op Fl n Ar number 18.Op Ar file ... 19.Sh DESCRIPTION 20.Nm Strings 21displays the sequences of printable characters in each of the specified 22files, or in the standard input, by default. 23By default, a sequence must be at least four characters in length 24before being displayed. 25.Pp 26The options are as follows: 27.Bl -tag -width Ds 28.It Fl a 29By default, 30.Nm strings 31only searches the text and data segments of object files. 32The 33.Fl a 34option causes 35.Nm strings 36to search the entire object file. 37.It Fl f 38Each string is preceded by the name of the file 39in which it was found. 40.It Fl n 41Specifies the minimum number of characters in a sequence to be 42.Ar number , 43instead of four. 44.It Fl o 45Each string is preceded by its decimal offset in the 46file. 47.El 48.Pp 49.Nm Strings 50is useful for identifying random binaries, among other things. 51.Sh SEE ALSO 52.Xr hexdump 1 53.Sh BUGS 54The algorithm for identifying strings is extremely primitive. 55In particular, machine code instructions on certain architectures 56can resemble sequences of ASCII bytes, which 57will fool the algorithm. 58.Sh COMPATIBILITY 59Historic implementations of 60.Nm 61only search the initialized data portion of the object file. 62This was reasonable as strings were normally stored there. 63Given new compiler technology which installs strings in the 64text portion of the object file, the default behavior was 65changed. 66.Sh HISTORY 67The 68.Nm 69command appeared in 70.Bx 3.0 . 71