[Previous] [Contents] [Next]

strings

Find printable strings in files (POSIX)

Syntax:

strings [-O format] [-a] [-n number] [file...]

Options:

-a
Scan files in their entirety (default; some implementations do not scan the entire file by default -- this option exists for application portability).
-n number
Search for strings that are number characters or longer. The number argument is a positive decimal integer (default is 4 characters).
-O format
Write each string, prefixed by its offset (in bytes). The format argument controls the number system used to print the offset:
To print in:  Specify:
octal o
hex x
decimal d
The default is octal.
file
The pathname of a file to be used as input. If no files are specified, strings reads from the standard input.

Description:

The strings utility looks for printable strings in regular files and writes those strings to standard output, one per line. A printable string is any sequence of number or more printable characters followed by a newline or NUL character.

Examples:

For the file /.boot, output all printable strings equal to or longer than four characters and prefix each line with the octal offset from the beginning of the file:

    strings /.boot

Output all printable strings equal to or longer than 10 characters and prefix the line with the hex offset from the beginning of the file:

    strings -Ox -n10 /.boot

Exit status:

0
Successful completion.
>0
An error occurred.

[Previous] [Contents] [Next]