# Strings (Unix)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Strings_(Unix)
> Markdown URL: https://mediated.wiki/source/Strings_(Unix).md
> Source: https://en.wikipedia.org/wiki/Strings_(Unix)
> Source revision: 1319736183
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Shell command for extracting printable text from a binary file}}
{{lowercase}}
{{distinguish|string (computing)}}
{{one source |date=April 2024}}
{{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](/source/C_(programming_language))
| operating system       = [Unix](/source/Unix), [Unix-like](/source/Unix-like), [Plan 9](/source/Plan_9_from_Bell_Labs), [Inferno](/source/Inferno_(operating_system))
| platform               = [Cross-platform](/source/Cross-platform)
| genre                  = [Command](/source/Command_(computing))
| license                = Plan 9: [MIT License](/source/MIT_License)
| website                = 
}}
<code>'''strings'''</code> is a [shell command](/source/Shell_(computing)) that extracts [printable character](/source/printable_character) [strings](/source/String_(computer_science)) from a [file](/source/computer_file) {{endash}} which is particular useful for analyzing the content of a [binary file](/source/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](/source/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](/source/cat_(Unix))</code>.

The command searches for sequences of printable characters that end with a [NUL character](/source/null-terminated_string) 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](/source/ASCII) and [wide character](/source/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.

The command is available in [Unix](/source/Unix), [Plan 9](/source/Plan_9_from_Bell_Labs), [Inferno](/source/Inferno_(operating_system)), and [Unix-like](/source/Unix-like) systems. It is part of the [GNU Binary Utilities](/source/GNU_Binary_Utilities) ({{mono|binutils}}), and has been implemented in other operating systems including [Windows](/source/Microsoft_Windows).<ref>[cygwin](/source/cygwin)</ref>

==Example==

The following command searches the system's [BIOS](/source/BIOS) for strings that are at least 8 characters long:

 dd if=/dev/mem bs=1k skip=768 count=256 2>[/dev/null](/source/%2Fdev%2Fnull) | strings -n 8

==See also==
{{Portal|Free and open-source software}}
* {{Annotated link|GNU Debugger}}
* {{Annotated link|List of POSIX commands}}
* {{Annotated link|Paste (Unix)}}
* {{Annotated link|Strip (Unix)}}

==References==
{{Reflist}}

==External links==
{{Wikibooks|Guide to Unix|Commands}}
* {{man|cu|strings|SUS}}
* {{man|1|strings|Plan 9}}
* {{man|1|strings|Inferno}}

{{Unix 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}}

---
Adapted from the Wikipedia article [Strings (Unix)](https://en.wikipedia.org/wiki/Strings_(Unix)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Strings_(Unix)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
