Name

strings — stdin  stdout  - file  -- opt  --help  --version

Synopsis

strings [options] [files]

Binary files, such as executable programs and object files, usually contain some readable text. The strings program extracts that text and displays it on standard output. You can discover version information, authors’ names, and other useful tidbits with strings:

strings /usr/bin/who
$NetBSD: who.c,v 1.23 2008/07/24 15:35:41 christos Exp $
Copyright (c) 1989, 1993 The Regents of the University of
 California...

Combine strings and grep (a command that locates matching lines in a file; see File Text Manipulation) to make your exploring more efficient. Here we look for email addresses in the binary file for the emacs editor by searching for @ signs:

strings /usr/bin/emacs | grep '@'
bug-gnu-emacs@gnu.org

Useful options

-n length

Display only strings with length greater than length (the default = 4).

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.