Linux Command - strings
The Linux strings command can be used to view strings in a binary file.
Show all strings inside a binary file:
strings /bin/ls
Show file offsets in hex:
strings -t x /bin/ls
Check two files and print file names before each string:
strings -f /bin/ls /bin/pwd
Use alternate encoding:
strings -e S /bin/ls
| -a | scan whole file, normally default |
| -d | only print from initialized, loaed data sections |
| -f | print file name before each string |
| -n 5 | only print strings of min length |
| -t x | radix hex |
| -t o | radix octal |
| -t d | radix decimal |
| -e L | specify other encodings, good for finding wide character strings |
Encodings that can be specified:
| s | single-7-bit-byte characters (ASCII, ISO 8859, etc., default) |
| S | single-8-bit-byte characters |
| b | 16-bit bigendian |
| l | 16-bit littleendian |
| B | 32-bit bigendian |
| L | 32-bit littleendian |