Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SyncHist

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.


Why SyncHist?

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 10000 commands (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.

Prerequisites (For OpenWrt Users)

Since OpenWrt defaults to the lightweight ash shell, you must ensure Bash is active:

  1. Install Bash:

    # For OPKG systems
    opkg update && opkg install bash
    
    # For newer APK systems
    apk update && apk add bash
  2. Change Shell to Bash: Open /etc/passwd and update the shell path for your user (e.g., root) from /bin/ash to /bin/bash.


Installation

Automatic Installation (Recommended)

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.sh

Manual Installation

If 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.sh

Usage & Interactive Help

Once installed, reload your active shell or start a new connection:

source /etc/profile.d/bash_history.sh

You can view the dynamic help documentation at any time by running:

history-help

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A lightweight, secure, and persistent Bash history manager with real-time multi-terminal synchronization and auto-repairing file integrity. Optimized for OpenWrt and embedded Linux.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages