Strings (Unix): Difference between revisions

Content deleted Content added
Addbot (talk | contribs)
m Bot: Migrating 9 interwiki links, now provided by Wikidata on d:q709099 (Report Errors)
WikiCleanerBot (talk | contribs)
m v2.05b - Bot T13 CW#549 - Fix errors for CW project (Split link)
 
(42 intermediate revisions by 19 users not shown)
Line 1:
{{Short description|Shell command for extracting printable text from a binary file}}
{{lowercase}}
{{distinguish|string (computing)}}
In [[computer software]], '''strings''' is a program in [[Unix-like]] [[operating system]]s that finds and prints text [[string (computer science)|strings]] embedded in [[binary files]] such as executables.
{{Oneone source |date=JulyApril 20082024}}
{{Infobox software
| name = strings
| logo =
| screenshot = Strings Command.png
| screenshot size =
| caption = The {{code|strings}} command
| author =
| developer =
| released =
| latest release version =
| latest release date =
| programming language = [[C (programming language)|C]]
| operating system = [[Unix]], [[Unix-like]], [[Plan 9 from Bell Labs|Plan 9]], [[Inferno (operating system)|Inferno]]
| platform = [[Cross-platform]]
| genre = [[Command (computing)|Command]]
| license = Plan 9: [[MIT License]]
| website =
}}
<code>'''strings'''</code> is a [[Shell (computing)|shell command]] that extracts [[printable character]] [[String (computer science)|strings]] from a [[computer file|file]] {{endash}} which is particular useful for analyzing the content of 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>.
 
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.
It can be used on object files, and [[core dump]]s.
 
The command is available in [[Unix]], [[Plan 9 from Bell Labs|Plan 9]], [[Inferno (operating system)|Inferno]], and [[Unix-like]] systems. It is part of the [[GNU Binary Utilities]] ({{mono|binutils}}), and has been portedimplemented toin other operating systems including [[Microsoft Windows|Windows]].<ref>[[cygwin]]</ref>
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.
 
==Example==
Common usage includes piping it to <tt>[[grep]]</tt> and <tt>[[Fold (Unix)|fold]]</tt> or redirecting the output to a [[Computer file|file]].<ref>{{cite book|last=Kiddle|first=Oliver |coauthors=Jerry Peek and Peter Stephenson|title=From Bash to Z Shell|origyear=2004|publisher=Apress|isbn=1-59059-376-6|page=413}}</ref>
 
The following command searches the system's [[BIOS]] for strings that are at 8 characters long:
It is part of the [[GNU Binary Utilities]] (binutils), and has been ported to other operating systems including [[Microsoft Windows]].<ref>[[cygwin]]</ref>
 
dd if=/dev/mem bs=1k skip=768 count=256 2>[[/dev/null]] | strings -n 8 | less
==Example==
Using ''strings'' to print sequences of characters that are at least 8 characters long (this command prints the system's [[BIOS]] 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==
{{Portal|Free and open-source software}}
* {{Annotated link|GNU Debugger}}
 
* {{Annotated link|List of POSIX commands}}
*<tt>[[Cat (Unix)|cat]]</tt>
* {{Annotated link|Paste (Unix)}}
*[[GNU Debugger]]
*<tt>[[ {{Annotated link|Strip (Unix)|strip]]</tt>}}
 
==References==
Line 25 ⟶ 44:
 
==External links==
{{Wikibooks|Guide to Unix|Commands}}
{{One source|date=July 2008}}
* {{man|1cu|strings||print the strings of printable characters in filesSUS}}
* {{man|1|strings|Plan 9}}
* {{man|1|strings|Inferno}}
 
{{unixUnix commands}}
{{Plan 9 commands}}
 
[[Category:Unix text processing utilities]]
[[Category:Unix SUS2008 utilities]]
[[Category:Plan 9 commands]]
[[Category:Inferno (operating system) commands]]
[[Category:String (computer science)]]
 
 
{{unix-stub}}