A powerful shell configuration backup and restore tool that helps you forge your perfect shell environment across multiple machines.
- Cross-platform: Works on macOS and Linux (Debian, Ubuntu, etc.)
- Smart backups: Automatically detects and backs up common shell configurations
- Machine-specific: Organize backups by machine name (hostname by default)
- Flexible restore: Restore your macOS config to a fresh Debian machine
- Secure: Only backs up .pem files from .ssh, avoiding private keys
- Incremental: Each save creates a timestamped backup with a "latest" symlink
- Beautiful TUI: Enhanced list command with color-coded age indicators and rich information (v1.5.0+)
- Smart Filtering: Only shows genuine ShellForge backups, filtering out other directories
Build and install ShellForge:
make install # Builds and installs to ~/binOr use the setup script for full configuration:
chmod +x setup.sh ./setup.sh # Builds, installs, and configures shell filesThe setup script will:
- Install shellforge to
$HOME/bin/ - Add configuration to your
.zshrcand/or.bashrc - Set up helpful aliases (
sfs,sfr,sfl,sfsn) - Configure an auto-backup reminder
- Install shellforge to
Edit your shell config file to set your backup destination:
# Open your shell config vim ~/.zshrc # or ~/.bashrc# Find and update this line:export BACKUP_DEST="${HOME}/Backups/shellforge"
Reload your shell:
source~/.zshrc # or source ~/.bashrc
# Using current hostname
shellforge save
# Using custom machine name
shellforge save macbook-pro# Restore from current hostname's latest backup
shellforge restore
# Restore from a specific machine's backup
shellforge restore macbook-proshellforge list # Beautiful TUI display of all backups
shellforge list --verbose # Show more details including file previews- Zsh:
.zshrc,.zshenv,.zprofile,.zlogin,.zlogout,.zsh_history - Bash:
.bashrc,.bash_profile,.bash_history,.bash_aliases,.bash_logout - General:
.profile,.aliases,.exports,.functions,.path,.extra - Editors:
.vimrc,.gvimrc,.emacs,.nanorc - Tools:
.tmux.conf,.screenrc,.gitconfig,.gitignore_global - Others:
.curlrc,.wgetrc,.editorconfig,.npmrc,.yarnrc, etc.
.config/- General application configs.vim/,.emacs.d/- Editor configurations.oh-my-zsh/,.zsh/,.zprezto/,.zplug/,.zinit/- Zsh frameworks.tmux/- Tmux plugins and configs.local/share/zsh/- Zsh local data
.ssh/*.pem- Only PEM files (for infrastructure access).ssl/- Entire directory if it exists
- Git repositories (
.git/) - Package managers (
.npm/,.cargo/,.pyenv/, etc.) - Cache directories (
.cache/) - Downloads directory
- Node modules
- Virtual environments
$BACKUP_DEST/
├── macbook/
│ ├── 20240115_143022/
│ │ ├── home/ # Your backed up files
│ │ └── metadata/ # Backup information
│ │ └── backup_info.txt
│ └── latest -> 20240115_143022/
└── debian-server/
├── 20240115_150000/
└── latest -> 20240115_150000/
You can easily transfer your shell environment between machines:
# On your MacBook
shellforge save macbook-work
# On your Debian machine
shellforge restore macbook-workIf you have backups from versions before 1.5.0, they won't appear in the new enhanced list command. Run the migration script to add the necessary metadata:
# Make the script executable
chmod +x scripts/migrate-backups.sh
# Run the migration
./scripts/migrate-backups.shThis will scan your existing backups and add marker files so they appear in the enhanced list display.
ShellForge automatically detects and uses the following tools if installed:
- figlet: For stylish ASCII art banners
- lolcat: For rainbow colored output
- cowsay: For fun success messages
Install them for a more delightful experience:
# macOS
brew install figlet lolcat cowsay
# Debian/Ubuntu
sudo apt-get install figlet lolcat cowsayThe setup script automatically configures aliases:
sfs- Quick savesfr- Quick restoresfl- Quick listsfsn "message"- Save with a note
Auto-backup reminder: If you haven't backed up in 7+ days, you'll see a reminder when you open a new shell
Run
shellforge saveafter making significant shell configuration changesThe tool uses
rsyncwhen available for better restore performanceYour backups are organized by machine name and timestamp, making it easy to manage multiple systems
ShellForge now uses a modular build system. The source code is organized into modules that are combined during build time to create a single, portable shell script.
# Build release version
make
# Build debug version (with source markers)
make debug
# Build minimal version (stripped comments)
make minimal
# Clean build artifacts
make cleansrc/
├── core/ # Core functionality (constants, variables, utils)
├── lib/ # Shared libraries
├── modules/ # Feature modules (backup, restore, list)
├── header.sh # Script header
└── main.sh # Entry point
See ARCHITECTURE.md for detailed information about the modular structure.
This project is licensed under the MIT License. See the LICENSE file for details.