Strings (Unix): Difference between revisions

Content deleted Content added
m Reverted edit by 2001:9E8:B334:E200:5A3C:7A3D:D90B:A405 (talk) to last version by Cedar101
focus on command instead of program; focus on value (describe platforms later)
Line 20:
| website =
}}
<code>'''strings'''</code> is a [[shell (computing)|shell]] [[shell (computing)|command]] that searches a [[computer file|file]] for [[printable character]] [[String (computer science)|strings]] and writes them to [[standard output]].
In [[computer software]], '''strings''' is a program in [[Unix]], [[Plan 9 from Bell Labs|Plan 9]], [[Inferno (operating system)|Inferno]], and [[Unix-like]] [[operating system]]s that finds and prints the strings of printable characters in files. The files can be of regular text files or [[binary files]] such as executables. It can be used on object files and [[core dump]]s. '''strings''' is mainly useful for determining the contents of non-text files.
 
The command can be useful for analyzing the information in a [[binary file]]. By definition, a binary file contains data that is not printable text yet a binary file often does contain some printable character text {{endash}} often in relatively short sequences distributed throughout the file. These portions of the binary file can be informative as to what the file contains overall. For a [[text file]], a file containing all printable characters, the command prints the entire file content, and therefore, provides no utility over more commonly used file output commands such as <code>[[cat (Unix)|cat]]</code>.
==Overview==
Strings are recognized by looking for sequences of at least 4 (by default) printable characters terminating in a NUL character (that is, [[null-terminated string]]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.
By default, it only prints the strings from the initialized and loaded sections of object files; for other types of files, it prints the strings from the whole file.
With regular text files, '''strings''' and [[Cat_(Unix)|cat]] give different output.
[[Cat_(Unix)|cat]] outputs the non printable characters but '''strings''' does not.
 
The command searches for sequences of printable characters that end with a [[null-terminated string|NUL character]] but ignores any sequence that is less than a specified length or 4 characters by default. Some implementations provide options for determining what is recognized as a printable character, which is useful for finding non-[[ASCII]] and [[wide character]] text. By default, it only selects strings from the initialized and loaded sections of an object file. For other types of files, it selects strings from the whole file.
'''strings''' is part of the [[GNU Binary Utilities]] ({{mono|binutils}}), and has been ported to other operating systems including [[Microsoft Windows|Windows]].<ref>[[cygwin]]</ref>
 
'''strings'''The command is available in [[Unix]], [[Plan 9 from Bell Labs|Plan 9]], [[Inferno (operating system)|Inferno]], and [[Unix-like]] [[operating system]]s. It is part of the [[GNU Binary Utilities]] ({{mono|binutils}}), and has been portedimplemented to other operating systems including [[Microsoft Windows|Windows]].<ref>[[cygwin]]</ref>
 
==Example==