strings(1)

strings1

Print the strings of printable characters in files

Usage

strings [{-a | --all}] [{-e encoding | --encoding=encoding}] [{-f | --print-file-name}] [{-h | --help}] [{-n number | --bytes=number | -number}] [-o] [{-t radix | --radix=radix}] [{-v | --version}] [file ...]

Overview

For each file specified, the strings utility prints contiguous sequences of printable characters that are at least n characters long and are followed by an unprintable character. The default value of n is 4. By default, the strings utility only scans the initialized and loaded sections of ELF objects; for other file types, the entire file is scanned. The strings utility is mainly used for determining the contents of non-text files.

If no file name is specified as an argument, standard input is read.

The following options are available:

-a | --all

For ELF objects, scan the entire file for printable strings.

-e encoding | --encoding=encoding

Select the character encoding to be used while searching for strings. Valid values for argument encoding are:

s

for single 7-bit-byte characters (ASCII, ISO 8859).

S

for single 8-bit-byte characters.

l

for 16-bit little-endian.

b

for 16-bit big-endian.

L

for 32-bit little-endian.

B

for 32-bit big-endian.

The default is to assume that characters are encoded using a single 7-bit byte.

-f | --print-file-name

Print the name of the file before each string.

-h | --help

Print a usage summary and exit.

-n number | --bytes=number | -number Print the contiguous character sequence of at least number characters long, instead of the default of 4 characters. Argument number should specify a positive decimal integer.

-o

Equivalent to specifying -t o.

-t radix | --radix=radix

Print the offset from the start of the file before each string using the specified radix. Valid values for argument radix are:

d

for decimal

o

for octal

x

for hexadecimal

-v | --version

Display a version identifier and exit.

Exit status

The strings utility exits 0 on success, and >0 if an error occurs.

Examples

To display strings in /bin/ls use:

$ strings /bin/ls

To display strings in all sections of /bin/ln use:

$ strings -a /bin/ln

To display strings in all sections of /bin/cat prefixed with the filename and the offset within the file use:

$ strings -a -f -t x /bin/cat

Releases

87 releases since FreeBSD 2.0.5-RELEASE; the text changed 17 times.

  1. 2.0.5–2.2.2
  2. 2.2.5–2.2.9
  3. 3.0–4.0
  4. 4.1–4.3
  5. 4.4–4.11
  6. 5.0–5.2.1
  7. 5.3–8.4
  8. 9.0
  9. 9.1
  10. 9.2
  11. 9.3
  12. 10.0
  13. 10.1
  14. 10.2
  15. 10.3
  16. 10.4
  17. 11.0–15.1
  18. 16.0

--all since FreeBSD 3.0-RELEASE; --help since FreeBSD 3.0-RELEASE; --print-file-name since FreeBSD 3.0-RELEASE; --version since FreeBSD 3.0-RELEASE; -h since FreeBSD 11.0-RELEASE; -v since FreeBSD 3.0-RELEASE.

--bytes until FreeBSD 10.4-RELEASE; --encoding until FreeBSD 10.4-RELEASE; --radix until FreeBSD 10.4-RELEASE; --target until FreeBSD 10.4-RELEASE; -T until FreeBSD 10.4-RELEASE; -bytes until FreeBSD 4.0-RELEASE; -e until FreeBSD 10.4-RELEASE; -min-len until FreeBSD 10.4-RELEASE; -n until FreeBSD 10.4-RELEASE; -t until FreeBSD 10.4-RELEASE.

History

The first FreeBSD strings utility appeared in FreeBSD v3. It was later discontinued in FreeBSD v5, when i386-only a.out format was dropped in favor of ELF.

Authors

The strings utility was re-written by S.Sam Arun Raj ⟨[email protected]⟩. This manual page was written by S.Sam Arun Raj ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.