Skip to main content

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

FlagDescription
-a, --allScan the entire file, not just the initialized data sections of object files.
-n, --bytes=MIN-LENPrint sequences of characters that are at least MIN-LEN characters long, instead of the default 4.
-t, --radix=RADIXPrint the offset within the file before each string (o for octal, d for decimal, x for hex).

Real-world Examples

  1. Extract strings from a binary executable:

    strings /bin/ls
  2. Find strings of at least 10 characters long:

    strings -n 10 /bin/bash
  3. Find strings and show their decimal offset in the file:

    strings -t d unknown_binary