.TH HISTORY 1 "January 2026" "history 1.0" "User Commands"
.SH NAME
history \- unified history viewer for terminal, clipboard, and browser searches
.SH SYNOPSIS
.B history
.B \-m
.I mode
.RI [ OPTIONS ]
.SH DESCRIPTION
.B history
is a unified history management system that tracks and queries:
.IP \(bu 2
Terminal commands (with exit codes and working directory)
.IP \(bu 2
Clipboard contents (with automatic deduplication)
.IP \(bu 2
Browser search queries (from Librewolf, Firefox, Brave, Chrome)
.PP
All entries are timestamped and stored in a SQLite database at
.IR ~/.local/share/history/history.db .
.SH MODES
The
.B \-m
flag is required and specifies which history to query:
.TP
.BR t ", " terminal
Terminal command history
.TP
.BR c ", " clipboard
Clipboard history
.TP
.BR s ", " search
Browser search history
.SH OPTIONS
.TP
.BI \-o " format"
Output format:
.BR t " (table),"
.BR j " (json),"
.BR p " (plain text, default)"
.TP
.BI \-n " count"
Number of entries to show (default: 100, use 0 for unlimited)
.TP
.BI \-d " date"
Filter by specific date in YYYY.MM.DD format
.TP
.BI \-q " query"
Search within entries (fuzzy match)
.TP
.BI \-b " browser"
Filter by browser name (search mode only). Valid values:
.BR librewolf ", " firefox ", " brave ", " chrome ", " chromium
.TP
.BI \-\-from " date"
Start date for range filter (YYYY.MM.DD)
.TP
.BI \-\-to " date"
End date for range filter (YYYY.MM.DD)
.TP
.B \-\-all
Show all entries (no limit, use with caution on large databases)
.TP
.B \-\-stats
Show statistics instead of entries
.TP
.BR \-h ", " \-\-help
Display help message
.SH EXAMPLES
.TP
Show last 100 terminal commands:
.B history \-m t
.TP
Show last 50 terminal commands in table format:
.B history \-m t \-n 50 \-o t
.TP
Search terminal history for git commands:
.B history \-m t \-q "git"
.TP
Show clipboard entries from a specific day:
.B history \-m c \-d 2026.01.23
.TP
Show Librewolf searches as JSON:
.B history \-m s \-b librewolf \-o j
.TP
Show searches from date range:
.B history \-m s \-\-from 2026.01.01 \-\-to 2026.01.15
.TP
Show terminal statistics:
.B history \-m t \-\-stats
.SH FILES
.TP
.I ~/.local/share/history/history.db
SQLite database containing all history
.TP
.I ~/.local/share/history/.last_sync
Timestamp of last browser sync
.TP
.I ~/.config/fish/conf.d/history.fish
Fish shell hooks for terminal logging
.TP
.I ~/.config/systemd/user/history-clipboard.service
Systemd service for clipboard daemon
.TP
.I ~/.config/systemd/user/history-browser-sync.timer
Systemd timer for browser sync (every minute)
.SH SETUP
Initialize the database:
.PP
.RS
.B history-init
.RE
.PP
Enable the clipboard daemon:
.PP
.RS
.B systemctl \-\-user enable \-\-now history-clipboard.service
.RE
.PP
Enable browser sync:
.PP
.RS
.B systemctl \-\-user enable \-\-now history-browser-sync.timer
.RE
.SH DATABASE SCHEMA
.SS terminal_history
.TS
l l.
id INTEGER PRIMARY KEY
timestamp DATETIME
command TEXT
exit_code INTEGER
pwd TEXT
shell TEXT
.TE
.SS clipboard_history
.TS
l l.
id INTEGER PRIMARY KEY
timestamp DATETIME
content TEXT
content_type TEXT
hash TEXT UNIQUE
.TE
.SS search_history
.TS
l l.
id INTEGER PRIMARY KEY
timestamp DATETIME
query TEXT
browser TEXT
url TEXT
hash TEXT UNIQUE
.TE
.SH AUTHOR
Kris Yotam <krisyotam@protonmail.com>
.SH SEE ALSO
.BR sqlite3 (1),
.BR fish (1),
.BR xclip (1)