A lightweight clipboard history manager for the command line. Track, search, and paste your clipboard history with ease.
Ever copied something important, then accidentally overwritten it? clip-stack keeps a searchable history of everything you copy, so you can find and reuse past clips instantly from the terminal.
- Persistent History — SQLite-backed clipboard history that survives restarts
- Quick Search — Find any past clip by keyword
- Fuzzy Paste — Copy any history item back to clipboard by ID
- Usage Stats — See which clips you use most often
- Deduplication — Automatic duplicate detection and removal
- Monitor Mode — Background daemon that captures everything you copy
# Install
pip install pyperclip # the only dependency
# Make it executable
chmod +x clip-stack.py
# Start monitoring clipboard (runs in background)
./clip-stack.py --monitor
# List recent clips
./clip-stack.py
# Search history
./clip-stack.py --search "password"
# Paste a specific item back
./clip-stack.py --paste 5
# Show statistics
./clip-stack.py --statsgit clone https://github.com/xuzhentao915/clip-stack.git
cd clip-stack
pip install pyperclip
chmod +x clip-stack.py
./clip-stack.py --monitorpip install pyperclip
sudo cp clip-stack.py /usr/local/bin/clip-stack
clip-stack --monitor$ clip-stack --monitor
Monitoring clipboard... Press Ctrl+C to stop.
History saved to: ~/.clip_stack/history.db
[10:25:30] Saved: How to configure SSH keys...
[10:26:15] Saved: export API_KEY=sk-1234567890abcdef$ clip-stack
ID When #Paste Content
--------------------------------------------------------------------------------
42 10:26:15 0 export API_KEY=sk-1234567890abcdef
41 10:25:30 0 How to configure SSH keys on Linux servers...
40 10:15:22 3 SELECT * FROM users WHERE id = 1;
39 10:10:05 1 docker-compose -f prod.yml up -d$ clip-stack --search "docker"
ID When #Paste Content
--------------------------------------------------------------------------------
39 10:10:05 1 docker-compose -f prod.yml up -d$ clip-stack --paste 42
Pasted: export API_KEY=sk-1234567890abcdef$ clip-stack --stats
Total entries: 42
Database: ~/.clip_stack/history.db
Most pasted:
[5x] docker-compose -f prod.yml up -d
[3x] SELECT * FROM users WHERE id = 1;
[2x] npm run build && npm run start| Flag | Description |
|---|---|
-l, --limit N |
Show N entries (default: 20) |
-s, --search TEXT |
Search for TEXT in history |
-p, --paste ID |
Paste item ID back to clipboard |
-d, --delete ID |
Delete item ID from history |
-c, --clear |
Clear all history |
--stats |
Show usage statistics |
--monitor |
Start clipboard monitoring daemon |
--dedup |
Remove duplicate entries |
--import FILE |
Import entries from text file |
┌─────────────────────────────────────────────────────────┐
│ clip-stack --monitor │
│ │
│ ┌──────────┐ ┌──────────────┐ ┌───────────┐ │
│ │ Clipboard │ ──▶ │ Monitor Loop │ ──▶ │ SQLite │ │
│ │ (system) │ │ (1s poll) │ │ DB file │ │
│ └──────────┘ └──────────────┘ └───────────┘ │
│ │ │
│ ┌──────────┐ ┌──────────────┐ │ │
│ │ Paste │ ◀── │ Lookup & │ ◀──────────┘ │
│ │(command) │ │ Restore │ │
│ └──────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────┘
History is stored at ~/.clip_stack/history.db (SQLite). Maximum 1000 entries are kept by default (oldest are auto-deleted).
To change the limit, edit MAX_ENTRIES in clip-stack.py.
- Python 3.8+
pyperclippackage
MIT © xuzhentao915