Skip to content

strings

65 commands

Prints sequences of printable characters from binary files — a fast first look at executables, memory dumps and unknown data.

  • binary analysis
  • triage

Install strings

sudo apt install binutils

Basic String Extraction4

strings sample.bin

Extracts default human-readable ASCII strings from the specified binary file.

Link
strings -a sample.bin

Forces the scan of the entire file rather than just specific initialized data sections.

Link
strings --all sample.bin

Equivalent to the -a flag, ensuring every byte of the file is analyzed for printable characters.

Link
strings - sample.bin

Uses the dash shorthand to explicitly instruct strings to scan the whole file.

Link

Length Control3

strings -n 8 sample.bin

Filters output to only show strings with a minimum length of 8 characters, reducing noise.

Link
strings --bytes=10 sample.bin

Sets the minimum sequence length to 10 characters using the verbose flag syntax.

Link
strings -6 sample.bin

Uses legacy shorthand to set the minimum string length to 6 characters.

Link

File and Input Handling2

strings -f *.bin

Prints the filename before each string found, useful when scanning multiple files simultaneously.

Link
strings --print-file-name sample.bin

Explicitly enables filename prefixing for the output, aiding in attribution during bulk analysis.

Link

Offset and Locations4

strings -t d sample.bin

Displays the offset (location) of each string within the file in decimal format.

Link
strings -t x sample.bin

Displays the offset of each string in hexadecimal format, standard for hex editor cross-referencing.

Link
strings -t o sample.bin

Displays the offset of each string in octal format.

Link
strings --radix=x sample.bin

Sets the offset radix to hexadecimal using the verbose argument style.

Link

Encoding and Character Sets6

strings -e s sample.bin

Explicitly scans for standard 7-bit ASCII characters (default behavior).

Link
strings -e S sample.bin

Scans for 8-bit characters to capture ISO-8859 or extended ASCII strings.

Link
strings -e l sample.bin

Scans for 16-bit little-endian characters, commonly used for Windows UTF-16 (Unicode) strings.

Link
strings -e b sample.bin

Scans for 16-bit big-endian characters, often found in network appliances or legacy architectures.

Link
strings -e L sample.bin

Scans for 32-bit little-endian characters.

Link
strings -e B sample.bin

Scans for 32-bit big-endian characters.

Link

Output Formatting2

strings -s ' :: ' sample.bin

Inserts a custom separator string between output items instead of a newline.

Link
strings --output-separator=',' sample.bin

Uses a comma as the output separator, facilitating CSV-style output generation.

Link

Combined Basic Workflows2

strings -a -t x -n 10 sample.bin

Combines scanning all bytes, hex offsets, and minimum length filtering for a standard initial triage.

Link
strings -e l -t x sample.bin

Extracts UTF-16 strings with their hexadecimal offsets to locate Unicode artifacts.

Link

Malware and Artifact Analysis7

strings sample.bin | grep -i 'http'

Pipes output to grep to search for HTTP/HTTPS URLs specifically.

Link
strings -e l sample.bin | grep -i 'c:\\'

Searches for Windows file paths inside Unicode-encoded strings.

Link
strings sample.bin | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'

Uses regex to extract potential IPv4 addresses from the binary.

Link
strings sample.bin | grep -i 'pdb'

Searches for PDB (Program Database) paths which often reveal the developer's username and project path.

Link
strings sample.bin | grep -i 'user-agent'

Hunts for hardcoded User-Agent strings used in network communications.

Link
strings sample.bin | grep -E '^[A-Za-z0-9+/]{20,}={0,2}#x27;

Attempts to identify long Base64 encoded strings which may represent obfuscated configurations.

Link
strings sample.bin | grep -iE '(powershell|cmd|bash|sh)'

Scans for shell execution commands indicating potential system command injection capabilities.

Link

Incident Response Investigations4

strings -a memory.dmp | grep -C 5 'password'

Searches a memory dump for the term 'password' and prints 5 lines of surrounding context.

Link
strings -e l memory.dmp | grep -i 'cmd.exe'

Searches a raw memory dump for Unicode references to command prompt executions.

Link
strings -f /var/log/nginx/* | grep 'eval('

Scans multiple log files for PHP eval injection attempts while maintaining filename context.

Link
cat disk_image.dd | strings -t d > image_strings.txt

Streams a disk image into strings and saves the output with offsets to a text file for offline searching.

Link

Automation and Pipeline Workflows4

strings sample.bin | sort | uniq -c | sort -nr

Counts unique string occurrences and sorts them by frequency to identify repeated patterns.

Link
strings -n 20 sample.bin | head -n 15

Quickly previews the first 15 long strings (20+ chars) to get a high-level overview of the binary.

Link
strings sample.bin | grep -vFf whitelist.txt

Filters out known-good strings listed in a file, leaving only anomalous or unique strings.

Link
find . -name '*.exe' -exec strings -f {} + | grep '192.168.'

Recursively finds all EXE files in a directory and scans them for a specific local IP range.

Link

Advanced Filtering2

strings -t x sample.bin | awk '{print $1, $2}'

Uses AWK to clean output, printing only the offset and the first word of the string string.

Link
strings sample.bin | tr -d '\n' | grep -o 'http[^ ]*'

Removes newlines to treat output as a stream and extracts full URLs without breaks.

Link

Blue Team Defensive Validation3

strings -n 50 codebase_build.exe

Checks compiled internal binaries for accidentally left-in long debug messages or API keys.

Link
strings lib.so | grep 'GLIBC'

Verifies linked library versions and dependencies in Linux ELF binaries.

Link
strings -a production_config.dat | grep -iE '(key|token|secret)'

Scans configuration binaries for hardcoded secrets or tokens before deployment.

Link

Digital Forensics Reporting2

strings -t x -e l sample.bin > unicode_artifacts.txt

Generates a comprehensive report of Unicode artifacts with offsets for a forensic case file.

Link
strings -a sample.bin | md5sum

Calculates a hash of the extracted strings to create a signature for the string content independent of the binary wrapper.

Link

Advanced Encoding Workflows2

strings -e S -n 6 sample.bin

Targets 8-bit character encoding with a minimum length of 6 to find non-standard ASCII tables.

Link
strings -e B -t x sample.bin

Analyzes Big-Endian 32-bit architecture dumps (like PowerPC or older Mac) for readable text.

Link

Targeted Artifact Hunting3

strings sample.bin | grep -i 'registry'

Looks for references to Windows Registry modification or querying activities.

Link
strings sample.bin | grep -i '\.onion'

specifically searches for Tor hidden service addresses often used in ransomware notes.

Link
strings sample.bin | grep -i 'bitcoin:'

Searches for cryptocurrency wallet addresses or payment URI schemes.

Link

Advanced Forensics2

strings -a -t x sample.bin | grep '4d 5a'

Looks for string representations of the MZ header to identify embedded executables (less reliable than hex editors but useful).

Link
strings sample.bin | grep -E '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}'

Extracts email addresses using a standard regex pattern.

Link

Section Analysis2

objcopy -O binary --only-section=.text sample.elf /dev/stdout | strings

Extracts only the .text (code) section of an ELF binary and pipes it to strings to ignore data sections.

Link
objcopy -O binary --only-section=.rdata sample.exe /dev/stdout | strings

Extracts the .rdata (read-only data) section where constants and import tables are usually stored.

Link

Complex Piping2

strings sample.bin | grep -vE '^.{0,4}#x27; | sort | uniq

Filters out very short strings (less than 5 chars), sorts the remainder, and removes duplicates.

Link
strings -e l sample.bin | iconv -f UTF-16LE -t UTF-8

Extracts Little Endian strings and converts them to UTF-8 for easier processing by other terminal tools.

Link

Timeline Analysis1

strings sample.bin | grep -E '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{1,2}'

Searches for standard syslog timestamps to build a rudimentary timeline from a binary blob.

Link

Obfuscation Detection2

strings sample.bin | awk 'length($0) > 100'

Isolates extremely long strings which may indicate packed data, base64 blobs, or embedded keys.

Link
strings -n 3 sample.bin | grep -E '^[a-zA-Z]+#x27;

Filters for pure alphabetic strings to detect variable names or function calls in obfuscated scripts.

Link

Cross-Platform Analysis1

strings -e b -t x firmware.bin > big_endian_strings.txt

Creates a specific extraction file for Big Endian architecture targets often found in IoT devices.

Link

Live Memory Analysis1

sudo cat /proc/kcore | strings -n 10 | grep 'secret_key'

Reads the live kernel memory (dangerous/requires root) and searches for a specific key in memory.

Link

File Identification1

strings sample.bin | head -n 5

Checks the very beginning of the file for readable headers (like 'ELF', 'MZ', 'JFIF') to identify file type.

Link

Compiler Artifacts2

strings sample.bin | grep -i 'gcc'

Searches for GCC version strings to identify the compiler version and environment used by the attacker.

Link
strings sample.bin | grep -i 'visual studio'

Identifies if the binary was compiled with Visual Studio, potentially revealing the linker version.

Link

Cleanup1

strings sample.bin > /dev/null

Runs strings and discards output, useful for testing command execution time or stability on large files.

Link