strings_cmd

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package strings_cmd implements the strings builtin command.

strings — print the sequences of printable characters in files

Usage: strings [OPTION]... [FILE]...

Print printable character sequences in files. With no FILE, or when FILE is -, read standard input.

A printable character is any byte in the range 0x20–0x7e (inclusive), or a horizontal tab (0x09). Sequences shorter than the minimum length (default 4) are silently discarded.

Accepted flags:

-a, --all
    Scan the entire file (already the default; accepted for POSIX
    compatibility).

-n min-len, --bytes=min-len
    Minimum sequence length to report (default 4). Must be >= 1.

-t format, --radix=format
    Print the file byte offset before each string, formatted according
    to format:
      o = octal
      d = decimal
      x = hexadecimal
    The offset is right-justified in a 7-character field followed by a
    single space, matching GNU strings output.

-o
    Legacy alias for -t o (octal offsets).

-f, --print-file-name
    Print the file name before each string.

-s separator, --output-separator=separator
    Use separator instead of a newline after each string.

-h, --help
    Print usage to stdout and exit 0.

Exit codes:

0  All files processed successfully.
1  At least one error occurred (missing file, permission denied, etc.).

Memory safety:

Input is read in 32 KiB chunks. Individual strings are capped at
maxStringLen (1 MiB) to prevent memory exhaustion — the first 1 MiB of
an extremely long printable run is emitted and scanning continues.
All read loops check ctx.Err() at each iteration to honour the shell's
execution timeout and support graceful cancellation.

Index

Constants

This section is empty.

Variables

View Source
var Cmd = builtins.Command{
	Name:        "strings",
	Description: "print printable character sequences",
	MakeFlags:   registerFlags,
}

Cmd is the strings builtin command descriptor.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL