Operating modes

peek runs in one of four output modes (plus --extract / -x, which writes a single inner item to disk or stdout):

ModeTriggerBehavior
ViewerStdout is a TTY (default)Full-screen interactive viewer
Print--print/-p or stdout is pipedDirect stdout, no interactivity
Info-only--infoPrint metadata and exit
List-only--listPrint container TOC and exit (archives, ISOs, directories, PDF / EPUB / DOCX / ODT / RTF / audio / comic embeds)

Binary files default to the hex-dump viewer when interactive; piped binary streams a hex dump.

Input

peek is a single-file viewer: at most one positional argument. To view several files, run peek once per file.

ScenarioStdin is TTYStdin is piped
peek (no args)Show short helpRead stdin, render
peek -Read stdin (blocks until Ctrl-D)Read stdin, render
peek file.rsView file normallyView file (stdin ignored)

Stdin is auto-detected by magic bytes (images, binary) and content sniffing (JSON, YAML, XML, SVG, HTML). Plain text falls back to --language for syntax highlighting.

After consuming piped stdin, peek reopens the terminal so the interactive viewer's keyboard input still works.

Output

  • Viewer: full-screen, alt-screen, no scrollback pollution. Quit returns the terminal unchanged.
  • Print: streams to stdout. Safe to pipe into less, grep, head. --plain / -P strips ANSI escapes, pretty-printing, and rich renders.
  • --info: prints the file info screen and exits.
  • --list: prints the container TOC and exits — works for archives, ISOs, directories, and per-page / per-file embed listings in PDF / EPUB / DOCX / ODT / RTF / audio / comic files.