TrumanWong

strings

Find a printable string in an object file or binary file

Supplementary instructions

strings command Finds printable strings in an object file or binary file. A string is any sequence of 4 or more printable characters, terminated by a newline or null character. The strings command is useful for identifying random object files.

grammar

strings [ -a ] [ - ] [ -o ] [ -t Format ] [ -n Number ] [ -Number ] [file ... ]

Options

-a --all: scan the entire file instead of just scanning the target file initialization and loading sections
-f –print-file-name: Display the file name before displaying the string
-n –bytes=[number]: Find and output all NUL terminator sequences
-: Set the minimum number of characters displayed, the default is 4 characters
-t --radix={o,d,x}: Output character position, based on octal, decimal or hexadecimal
-o: similar to --radix=o
-T --target=: Specify binary file format
-e --encoding={s,S,b,l,B,L}: Select character size and sort order: s = 7-bit, S = 8-bit, {b,l} = 16-bit, { B,L} = 32-bit
@: Read options

Example

List all ASCII text in ls:

strings /bin/ls

List all ASCII text in ls:

cat /bin/ls strings

Find strings containing libc in ls, case-insensitive:

strings /bin/ls | grep -i libc