A lightweight, secure, and persistent Bash history configuration with real-time multi-terminal synchronization and auto-repairing file integrity. Strongly optimized for OpenWrt and other resource-constrained embedded systems, yet compatible with any Linux distribution.
By default, OpenWrt uses a minimal shell configuration where command history is kept in volatile RAM (/tmp) and lost upon reboot. Furthermore, active concurrent shell sessions overwrite each other's logs.
SyncHist solves these pain points by providing:
- Persistent History: Saves command logs directly to permanent storage.
- Managed Capacity: Default history limit set to
10000commands (easily editable). - Real-Time Cross-Terminal Sync: Commands executed in Session A are instantly available in Session B.
- Auto-Repair & Security: Automatically checks, creates, and secures history file permissions to owner-only (
chmod 600) at boot. - Embedded Optimization: Skips slow disk checks if the active directory and file permissions are already correct.
Since OpenWrt defaults to the lightweight ash shell, you must ensure Bash is active:
-
Install Bash:
# For OPKG systems opkg update && opkg install bash # For newer APK systems apk update && apk add bash
-
Change Shell to Bash: Open
/etc/passwdand update the shell path for your user (e.g.,root) from/bin/ashto/bin/bash.
Clone this repository and run the automated installer:
# Clone the repository
git clone https://github.com/Shahin-Ataei/SyncHist.git
cd SyncHist
# Run the installer as root
chmod +x install.sh
./install.shIf you prefer not to use the installer, simply copy the file manually:
# Download and copy directly to profile directory
wget -qO /etc/profile.d/bash_history.sh https://raw.githubusercontent.com/Shahin-Ataei/SyncHist/main/bash_history.sh
chmod +x /etc/profile.d/bash_history.shOnce installed, reload your active shell or start a new connection:
source /etc/profile.d/bash_history.shYou can view the dynamic help documentation at any time by running:
history-helpThis project is licensed under the MIT License - see the LICENSE file for details.