Strings (Unix)

Shell command for extracting printable text from a binary file

Not to be confused with string (computing).

This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.
Find sources: "Strings" Unix – news · newspapers · books · scholar · JSTOR (April 2024)

|

strings

The `strings` command

Written in| C
Operating system| Unix, Unix-like, Plan 9, Inferno
Platform| Cross-platform
Type| Command
License| Plan 9: MIT License

`strings` is a shell command that extracts printable character strings from a file – 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 – 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 `cat`.

The command searches for sequences of printable characters that end with a 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.

The command is available in Unix, Plan 9, Inferno, and Unix-like systems. It is part of the GNU Binary Utilities (binutils), and has been implemented in other operating systems including Windows.[1]

## Example

[edit]

The following command searches the system's BIOS for strings that are at 8 characters long:

dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8

## See also

[edit]

* Free and open-source software portal

* GNU Debugger – Source-level debugger
* List of POSIX commands
* Paste (Unix) – Shell command for joining files horizontally
* Strip (Unix) – Shell command for removing non-essential information from executable code files

## References

[edit]

1. ^ cygwin

## External links

[edit]

The Wikibook Guide to Unix has a page on the topic of: Commands

* `strings` – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group
* `strings(1)` – Plan 9 Programmer's Manual, Volume 1
* `strings(1)` – Inferno General commands Manual

* v
* t
* e

Unix command-line interface programs and shell builtins

File system|

* cat
* chattr
* chmod
* chown
* chgrp
* cksum
* cmp
* cp
* dd
* du
* df
* file
* fuser
* ln
* ls
* mkdir
* mv
* pax
* pwd
* rm
* rmdir
* split
* tee
* touch
* type
* umask

Processes|

* at
* bg
* crontab
* fg
* kill
* nice
* ps
* time

User environment|

* env
* exit
* logname
* mesg
* talk
* tput
* uname
* who
* write

Text processing|

* awk
* basename
* comm
* csplit
* cut
* diff
* dirname
* ed
* ex
* fold
* head
* iconv
* join
* m4
* more
* nl
* paste
* patch
* printf
* read
* sed
* sort
* strings
* tail
* tr
* troff
* uniq
* vi
* wc
* xargs

Shell builtins|

* alias
* cd
* echo
* test
* unset
* wait

Searching|

* find
* grep

Documentation|

* man

Software development|

* ar
* ctags
* lex
* make
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* expr
* lp
* od
* sleep
* true and false

* Categories
* Standard Unix programs
* Unix SUS2008 utilities
* List

* v
* t
* e

Plan 9 command-line interface programs and shell builtins

File system|

* chmod
* chgrp
* cmp
* cp
* dd
* du
* file
* gzip
* ls
* mkdir
* pwd
* rm
* split
* tee
* touch

Processes|

* kill
* ps

User environment|

* passwd
* who

Text processing|

* awk
* basename
* comm
* diff
* ed
* eqn
* join
* sed
* sort
* spell
* strings
* tail
* tr
* troff
* uniq
* wc

Shell builtins|

* echo
* test

Networking|

* ip/ipconfig
* ip/ping
* netstat

Searching|

* grep

Software development|

* ar
* hoc
* lex
* nm
* strip
* yacc

Miscellaneous|

* bc
* cal
* fortune
* sleep

* Category

This Unix-related article is a stub. You can help Wikipedia by expanding it.

|

* v
* t
* e

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template