In
computer softwareComputer software, or just software is a general term used todescribe the role that computer programs, procedures anddocumentation play in a computer system.The term includes:...
,
strings is a program in
Unix-likeA Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
operating systemAn operating system is an interface between hardware and user which is responsible for the management and coordination of activities and the sharing of the resources of the computer that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating...
s that finds and prints text
stringsIn mathematics, a string is an sequence of symbols that are chosen from a set or alphabet.In computer programming, a string is, essentially, a sequence of characters...
embedded in binary files such as executables.
In
computer softwareComputer software, or just software is a general term used todescribe the role that computer programs, procedures anddocumentation play in a computer system.The term includes:...
,
strings is a program in
Unix-likeA Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
operating systemAn operating system is an interface between hardware and user which is responsible for the management and coordination of activities and the sharing of the resources of the computer that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating...
s that finds and prints text
stringsIn mathematics, a string is an sequence of symbols that are chosen from a set or alphabet.In computer programming, a string is, essentially, a sequence of characters...
embedded in binary files such as executables.
It can be used on object files, and
core dumpIn computing, a core dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally...
s.
Strings are recognized by looking for sequences of at least 4 (by default) printable characters terminating in a NUL character (that is,
C stringIn computing, a C string is a character sequence stored as a one-dimensional character array and terminated with a null character . The name refers to the ubiquitous C programming language which uses this string representation...
s). Some implementations provide options for determining what is recognized as a printable character, which is useful for finding non-ASCII and wide character text.
Common usage includes piping it to
grepgrep is a command line text search utility originally written for Unix. The name is taken from the first letters in global / regular expression / print, a series of instructions in text editors such as ed...
and
foldThe GNU Core Utilities or coreutils is a package of GNU software containing many of the basic tools, such as cat, ls, and rm, needed for Unix-like operating systems...
or redirecting the output to a
fileA computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...
.
It is part of the
GNU Binary UtilitiesThe GNU Binary Utilities, or binutils, is a collection of programming tools for the manipulation of object code in various object file formats. The current versions were originally written by programmers at Cygnus Solutions using the Binary File Descriptor library...
(binutils), and has been ported to other operating systems including
Microsoft WindowsMicrosoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces...
.
Example
Using
strings to print sequences of characters that are at least 8 characters long (this command prints the system's
BIOSIn IBM PC Compatible computers, the basic input/output system , also known as the System BIOS, is a de facto standard defining a firmware interface. The BIOS is boot firmware, designed to be the first code run by a PC when powered on...
information; should be run as root):
dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8 | less
See also
- cat
The cat command is a standard Unix program used to concatenate and display files. The name is from catenate, a synonym of concatenate.- Specification :...
- GNU Debugger
The GNU Debugger, usually called just GDB and named gdb as an executable file, is the standard debugger for the GNU software system. It is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, FreeBASIC, FreePascal and...
- strip
In Unix and Unix-like operating systems, the strip program removes unnecessary information from executable binary programs and object files, thus potentially resulting in better performance and sometimes significantly less disk space usage...