strings
Explanation
The strings command looks for printable strings in a file. It is primarily used to extract human-readable text from binary files (like compiled programs or core dumps), but it can be run on any file. A string is defined as a sequence of 4 or more printable characters ending with a newline or null character.
Basic Syntax
strings [OPTION]... [FILE]...
Common Flags and Options
| Flag | Description |
|---|---|
-a, --all | Scan the entire file, not just the initialized data sections of object files. |
-n, --bytes=MIN-LEN | Print sequences of characters that are at least MIN-LEN characters long, instead of the default 4. |
-t, --radix=RADIX | Print the offset within the file before each string (o for octal, d for decimal, x for hex). |
Real-world Examples
-
Extract strings from a binary executable:
strings /bin/ls -
Find strings of at least 10 characters long:
strings -n 10 /bin/bash -
Find strings and show their decimal offset in the file:
strings -t d unknown_binary