[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 5

strings Command

Purpose

Finds the printable strings in an object or binary file.

Syntax

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

Description

The strings command looks for printable strings in an object or binary file. A string is any sequence of 4 or more printable characters that end with a new-line or a null character. The strings command is useful for identifying random object files.

Flags

-a or - Searches the entire file, not just the data section, for printable strings.
-n Number Specifies a minimum string length other than the default of 4 characters. The maximum value of a string length is 4096. This flag is identical to the -Number flag.
-o Lists each string preceded by its octal offset in the file. This flag is identical to the -t o flag.
-t Format Lists each string preceded by its offset from the start of the file. The format is dependent on the character used as the Format variable.
d Writes the offset in decimal.
o Writes the offset in octal.
x Writes the offset in hexadecimal.
Note: When the -o and the -t Format flags are defined more than once on a command line, the last flag specified controls the behavior of the strings command.
-Number Specifies a minimum string length other than the default of 4 characters. The maximum value of a string length is 4096. This flag is identical to the -n Number flag.
File Binary or object file to be searched.

Exit Status

This command returns the following exit values:

0 Specifies that the command ran successfully.
>0 Specifies that an error occurred.

Examples

  1. To search a file, enter:
    strings strings
    The string command displays:
    @(#)56
    1.17 com/cmd/scan/strings.c, cdmscan, bos320 5/7/92 10:21:20
    Standard input
    strings.cat
    /usr/mbin/strings
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    %7o
    %7d
    %7x
    %7o
    %7d
  2. To search for strings at least 12 characters long, enter:
    strings -12 strings
    The string command displays:
    1.17 com/cmd/scan/strings.c, cdmscan, bos320 5/7/92 10:21:20
    Standard input
    /usr/mbin/strings
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
  3. To search for strings at least 20 characters long and show the offset in hexadecimal, enter:
    strings -t x -n 20 strings
    The string command displays:
    1017 1.17 com/cmd/scan/strings.c, cmdscan, bos320 5/7/92 10:21:20
    108c Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    10d8 Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    1124 Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    1170 Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]
    11bc Usage: strings [-a | -] [-o] [-t format] [-n | -#] [file...]

Related Information

The od command.


[ Previous | Next | Contents | Glossary | Home | Search ]