head
Return first N lines of files or stdin as JSON. Preview file beginnings or extract headers.
Instructions
Return the first N lines (default 10) of files or stdin as JSON. Read-only, no side effects. Returns JSON with line array by default; use --raw for plain text. Supports negative-N to skip all but the last N lines. Use to preview file beginnings or extract headers. Not for viewing file endings — use 'tail' for the last N lines. See also 'tail', 'cat'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoding | No | Text encoding. | utf-8 |
| lines | No | Number of lines. | |
| path | Yes | File to read. | |
| raw | No | Write raw selected lines without a JSON envelope. |