A high-performance PTY passthrough tool written in Go with live, toggleable output filtering.
- PTY Passthrough: Spawns a child process attached to a pseudo-terminal
- Interactive-Only: Designed for real terminal sessions, not piped input
- Interactive Shell Support: Default interactive shell with proper character echoing
- Live Filtering: Real-time filtering of output using regex patterns
- Minimal Interface: Simple, clean overlay without distracting UI elements
- Interactive Controls:
- Press
Ctrl+Sto enter filter mode with simple prompt - Press
Ctrl+Rto clear the filter and show all output
- Press
- Terminal Mode Management: Automatically handles raw terminal mode and restoration
- Signal Handling: Properly forwards signals to child processes
- Cross-platform Compatibility: Works on Unix-like systems
# Clone the repository
git clone <repository-url>
cd ttf
# Install dependencies
go mod tidy
# Build the project
go build -o ttf .
# Install globally (optional)
go install .Note: This is an interactive terminal program that must be run in a real terminal session, not with piped input.
# Start with default interactive shell (/bin/sh -i)
./ttf
# Start with specific command
./ttf -- /bin/bash
# Start with Python interactive mode
./ttf -- /usr/bin/python3 -i
# Start with custom command and arguments
./ttf -- ls -la- Enter Filter Mode: Press
Ctrl+S - Type Pattern: Enter a regex pattern (e.g.,
error|warning) - Apply Filter: Press Enter to enable filtering
- Clear Filter: Press
Ctrl+Rto show all output again
# Monitor log files with live filtering
./ttf -- tail -f /var/log/system.log
# Interactive Python session with filtered output
./ttf -- python3 -c "
import time
for i in range(10):
print(f'Line {i}: info message')
if i % 2 == 0:
print(f'Line {i}: error message')
time.sleep(1)
"
# Filter specific commands
./ttf -- find / -name "*.log" 2>/dev/nullgithub.com/creack/pty- PTY handlinggolang.org/x/term- Terminal mode management
# Run tests
go test ./...
# Format code
go fmt ./...
# Build
go build -o ttf .
# Clean
go clean- Process Spawning: Creates a child process attached to a pseudo-terminal
- Input Forwarding: Forwards keyboard input to the child process
- Output Filtering: Reads child output line by line and applies regex filtering
- Interactive Controls: Intercepts
Ctrl+SandCtrl+Rfor filter management - Terminal Management: Handles raw terminal mode and proper cleanup
MIT License