History

The suv history command prints your command history to stdout. Unlike suv search (interactive TUI) or suv export (bulk data), suv history is designed for quick lookups and piping to other tools like grep, jq, or wc.

Basic Usage

Show the last 25 commands (newest first):

suv history

Show the last 100 commands:

suv history -n 100

Filtering

All standard filters are available:

# Commands from today
suv history --after today

# Failed commands in the current directory
suv history --here --exit-code 1

# Agent-executed commands from the last week
suv history --executor agent --after "7 days ago"

# Commands in a specific directory
suv history --cwd ~/projects/myapp

# Filter by tag
suv history --tag work --after yesterday

JSON Output

Use --json for machine-readable JSONL output (one JSON object per line):

# Pipe to jq
suv history --json -n 10 | jq '.command'

# Count commands per directory
suv history --json -n 1000 | jq -r '.cwd' | sort | uniq -c | sort -rn

# Find slow commands
suv history --json --after today | jq 'select(.duration_ms > 5000) | .command'

Piping

When piped, ANSI colors are automatically disabled:

# Search for cargo commands
suv history -n 500 | grep cargo

# Count unique commands
suv history -n 10000 | awk '{print $NF}' | sort -u | wc -l

Flags Reference

Flag Description
-n, --limit <N>Number of entries to show (default: 25)
--after <DATE>Show commands after date (YYYY-MM-DD, "today", "yesterday", "N days ago")
--before <DATE>Show commands before date
--tag <TAG>Filter by tag name
--exit-code <N>Filter by exit code (0 = success)
--executor <EXEC>Filter by executor (e.g., "agent", "human")
--hereFilter to current directory
--cwd <DIR>Filter to a specific directory
--jsonOutput as JSON lines (one JSON object per line)