Ultimate Command Recorder is a powerful Bash script that records terminal sessions, captures all user commands and file system changes, and allows perfect reproduction of the session on other systems. The recorder creates comprehensive self-contained recordings that can be shared, replayed, and used for training, documentation, or troubleshooting purposes.
- Records all terminal commands with exact timing
- Captures all file system changes, including file creations and modifications
- Provides two replay methods:
- Command playback with visual feedback
- Full terminal session replay with exact keystroke timing
- Automatically pre-populates files for editors like nano, vim, and vi
- Captures content for files created or modified during the session
- Creates self-contained, portable recordings that can be moved between systems
- Offers debug logging for troubleshooting
No installation is required. Simply download the ultimate_recorder.sh script, make it executable, and run it:
chmod +x ultimate_recorder.sh
./ultimate_recorder.shRun the script without arguments to start recording with all features enabled:
./ultimate_recorder.shThis will start a new terminal session with a green record> prompt, indicating that recording is active.
The script supports several command-line options:
Usage: ./ultimate_recorder.sh [options]
Options:
--no-full Don't record full terminal session (keystrokes)
--no-commands Don't record commands for script generation
-h, --help Display this help message
While recording is active:
- Type commands as you normally would
- All keystrokes and screen output will be recorded
- All file operations will be captured, including:
- File creations
- File modifications
- Content changes in text editors
- To stop recording, type
stoprecordand press Enter
The recorder has special handling for text editors:
- Automatically detects when you use
nano,vi, orvim - Captures the content of files before and after editing
- Stores copies of edited files for replay
- During replay, pre-populates files with the correct content before opening in editors
After recording completes, a new directory is created in the current working directory named recorded_session_YYYYMMDD_HHMMSS. This directory contains:
| File/Directory | Purpose |
|---|---|
replay_commands.sh |
Script to replay just the commands with file integration |
replay_full_session.sh |
Script to replay the full terminal session with exact timing |
files/ |
Directory containing copies of all file content |
file_mapping.txt |
Maps original file paths to their saved contents |
command_log.txt |
Detailed log of executed commands |
tty_recording.tty |
Raw terminal recording data |
tty_timing.tim |
Timing data for the terminal recording |
debug.log |
Debug information (can be deleted) |
README.txt |
Instructions for usage |
To replay just the commands (with file system integration):
./recorded_session_YYYYMMDD_HHMMSS/replay_commands.shThis will:
- Restore all files created during the recording
- Execute each command with visual feedback
- Pre-populate files for editor commands
- Show command execution status
To replay the full terminal session:
./recorded_session_YYYYMMDD_HHMMSS/replay_full_session.shThis will:
- Restore all files created during the recording
- Replay the exact terminal session with original keystroke timing
- Show EVERYTHING exactly as it happened during recording
The recording directory is completely self-contained and portable:
- Copy the entire
recorded_session_YYYYMMDD_HHMMSSdirectory to any system - Make scripts executable (if needed):
chmod +x replay_commands.sh replay_full_session.sh
- Run either replay script as described above
The recorder uses multiple approaches to ensure all file changes are captured:
- Directory snapshots before and after operations
- Direct tracking of editor commands
- File state hashing for change detection
- Exit traps for nano editor state capture
The file_mapping.txt file uses a simple format:
/absolute/path/to/file1:content_file1.txt
/absolute/path/to/file2:content_file2.txt
This maps original file paths to their saved content in the files/ directory.
- Works best in Bash environments
- Limited support for graphical editors
- Does not track remote file operations
For troubleshooting, check the debug.log file in the recording directory. It contains detailed information about:
- Command detection
- File tracking
- Content capture
- Script generation
-
Missing files during replay:
- Check that the
file_mapping.txtcontains entries for all files - Ensure the
files/directory contains all content files
- Check that the
-
Editor files not pre-populated:
- Check editor command format in the recording
- Verify file paths in
file_mapping.txt
-
Command replay errors:
- Ensure dependencies installed on the replay system
- Check for system-specific commands that may not be portable
For complex environments, consider running from a script that sets up the environment first:
#!/bin/bash
# Set up the environment
export PATH=/custom/path:$PATH
cd /specific/work/directory
# Start recording
./path/to/ultimate_recorder.shFor creating tutorials:
- Plan your commands beforehand
- Record a clean session with good comments
- Distribute the session directory
- Recipients can use either replay method to follow along
This script is provided as-is for general use. Contributions and improvements are welcome.
Ultimate Command Recorder was created to provide a comprehensive solution for terminal session recording with full file system integration, allowing perfect reproduction of terminal sessions across different environments and systems.