terminal-print
Print iTerm2 terminal output to HP network printer. Strips ANSI escape codes, wraps in monospace code block, generates PDF via pandoc/xelatex, previews, and prints. Invoke on - print terminal, terminal to printer, print session, lpr output, print command output, terminal PDF.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Terminal Print
Print terminal output from iTerm2 to your HP network printer with a single command.
Quick Start
- Copy terminal output in iTerm2 (Cmd+C)
- Invoke this skill
- Review PDF preview, press Enter to print
How It Works
Clipboard → Strip ANSI → Markdown code block → pandoc/xelatex → PDF → Preview → Print
- ANSI codes stripped: Colors and escape sequences removed for clean B&W output
- Monospace font: DejaVu Sans Mono for proper character alignment
- Landscape orientation: Fits ~120 characters per line
- US Letter paper: Auto-detected from printer settings
Execution
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOF
Options
Run with arguments by modifying the execution block:
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF
| Flag | Description |
|---|---|
--file FILE |
Read from file instead of clipboard |
--no-preview |
Skip PDF preview, print directly |
--no-print |
Generate PDF only, don't send to printer |
-h, --help |
Show help message |
Examples
Print from clipboard (default)
# Copy terminal output in iTerm2, then:
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh"
EOF
Print from file
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOF
Generate PDF only (no print)
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --no-print
EOF
Prerequisites
All dependencies are already available on macOS with MacTeX:
| Tool | Purpose | Status |
|---|---|---|
pandoc |
Markdown to PDF | Required |
xelatex |
PDF engine | Required (MacTeX) |
pbpaste |
Clipboard access | Built-in |
lpr |
CUPS printing | Built-in |
Output
-
PDF location:
/tmp/terminal-output-YYYYMMDD_HHMMSS.pdf -
Markdown source:
/tmp/terminal-YYYYMMDD_HHMMSS.md -
Cleanup: macOS automatically cleans
/tmpperiodically
Troubleshooting
"No text in clipboard"
Copy terminal output first using Cmd+C in iTerm2.
"Missing pandoc" or "Missing xelatex"
Install MacTeX: brew install --cask mactex
Printer not found
Check printer status: lpstat -p -d
The default printer is HP_LaserJet_Pro_MFP_3101_3108. Edit the script to change.
Related Skills
- pandoc-pdf-generation - General Markdown to PDF conversion
- asciinema-converter - Convert terminal recordings
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-02-02
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!