Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimalist Bash Configuration

A clean, modular bash configuration that provides essential functionality while remaining easy to extend and customize. Now with a built-in package manager and load manager for optimal performance!

Features

  • Modular Design: Configuration is split into logical modules for easy maintenance
  • Essential Aliases: Common shortcuts for navigation, git, docker, and system commands
  • Useful Functions: File extraction, backup, search, and utility functions
  • Smart Prompt: Shows current directory and git branch (if available)
  • Enhanced Completion: Tab completion for custom functions and common tools
  • Cross-Platform: Works on Linux, macOS, and other Unix-like systems
  • Easy Extension: Simple module system for adding new functionality
  • 🎉 Package Manager: Install, manage, and discover custom bash packages from a registry
  • ⚡ Load Manager: Control what gets loaded for optimal startup performance
  • 📊 Performance Monitoring: Track startup time and optimize your configuration

Installation

  1. Clone or download this configuration to your home directory:

    git clone <repository-url> ~/.bashie
    cd ~/.bashie
  2. Run the installer:

    ./install.sh
  3. Restart your terminal or source the configuration:

    source ~/.bashrc

Configuration Structure

.bashrc                 # Main configuration file
bash.d/                 # Configuration modules directory
├── 01-environment.sh   # Environment variables and basic settings
├── 02-aliases.sh       # Command aliases
├── 03-prompt.sh        # Prompt configuration
├── 04-functions.sh     # Utility functions
├── 05-completion.sh    # Command completion
├── 06-example-extension.sh # Example extension module
├── 07-package-manager.sh   # Bash package manager
└── 08-load-manager.sh      # Load manager for performance
tools/                  # Development and management tools
├── create-package.sh   # Package creation tool
├── deploy-registry.sh  # Registry deployment tool
├── load-manager-ui.sh  # Interactive load manager UI
└── performance-monitor.sh # Performance monitoring tool
examples/               # Example packages and registry
├── registry.json       # Sample package registry
└── packages/           # Example packages
    ├── docker-utils.sh
    └── git-workflow.sh

🚀 Bash Package Manager

The bash configuration includes a powerful package manager that allows you to discover, install, and manage custom bash functionality from a centralized registry.

Quick Start with Packages

# Search for available packages
bp search docker

# Install a package
bp install docker-utils

# List installed packages
bp list

# Get package information
bp info git-workflow

# Update a package
bp update docker-utils

# Uninstall a package
bp uninstall docker-utils

Package Manager Commands

Command Description
bp install <package> Install a package
bp uninstall <package> Uninstall a package
bp list [filter] List installed packages
bp search <query> Search for packages
bp update [package] Update registry or specific package
bp info <package> Show package information
bp help Show help

⚡ Bash Load Manager

The load manager provides fine-grained control over what gets loaded, allowing you to optimize startup performance and manage your bash environment efficiently.

Quick Start with Load Manager

# List all modules and packages
blm list

# Enable/disable modules
blm enable 06-example-extension
blm disable 07-package-manager

# Enable/disable packages
blm enable docker-utils
blm disable git-workflow

# Set module priorities
blm priority 02-aliases 1

# Create and use profiles
blm profile save minimal
blm profile load development

Load Manager Commands

Command Description
`blm enable <module package>`
`blm disable <module package>`
blm list [filter] [all] List modules and packages
`blm status <module package>`
`blm reload <module package>`
blm priority <module> <1-10> Set module priority
blm profile <action> [name] Manage load profiles
blm help Show help

Interactive Load Manager UI

For easier management, use the interactive UI:

# Launch the interactive load manager
./tools/load-manager-ui.sh

This provides a user-friendly interface for:

  • Enabling/disabling modules and packages
  • Setting priorities
  • Managing profiles
  • Quick actions for common configurations

Load Profiles

Create different configurations for different use cases:

# Save current configuration as a profile
blm profile save minimal

# Save a development profile
blm profile save development

# Load a specific profile
blm profile load minimal

# List available profiles
blm profile list

Module Priorities

Control the loading order of modules (1 = highest priority, 10 = lowest):

# Set high priority for essential modules
blm priority 01-environment 1
blm priority 02-aliases 2

# Set lower priority for optional modules
blm priority 06-example-extension 8

📊 Performance Monitoring

Monitor and optimize your bash configuration performance:

# Measure startup time
./tools/performance-monitor.sh startup 5

# Analyze module loading times
./tools/performance-monitor.sh modules

# Analyze package loading times
./tools/performance-monitor.sh packages

# Show memory usage
./tools/performance-monitor.sh memory

# Generate complete performance report
./tools/performance-monitor.sh report

# Get optimization suggestions
./tools/performance-monitor.sh optimize

# Run all analyses
./tools/performance-monitor.sh all

Performance Tips

  • Disable unused modules: Use blm disable <module> for modules you don't need
  • Use profiles: Create different profiles for different use cases
  • Monitor regularly: Check performance with the monitoring tools
  • Lazy loading: Consider lazy loading for heavy functions
  • Priority management: Set appropriate priorities for modules

Key Features

Environment Settings

  • UTF-8 locale configuration
  • History settings (10,000 commands, ignore duplicates)
  • PATH management for common directories
  • Editor and pager preferences

Useful Aliases

  • Navigation: .., ..., home, desk, docs, dl
  • Safety: rm, cp, mv with confirmation
  • Git: gs, ga, gc, gp, gl, gd
  • System: ports, meminfo, diskusage
  • Development: py, pip, node, npm, d, dc

Utility Functions

  • extract <file> - Extract various archive formats
  • backup <file> - Create timestamped backup
  • ff <pattern> - Find files by name
  • fd <pattern> - Find directories by name
  • mkcd <dir> - Create directory and navigate to it
  • up <n> - Go up n directories
  • newscript <name> - Create new executable script
  • sysinfo - Show system information
  • weather [location] - Show weather (requires curl)
  • note [text] - Quick note taking

Enhanced Completion

  • Tab completion for all custom functions
  • Enhanced completion for git, docker, systemctl
  • File and directory completion

Extending the Configuration

Method 1: Package Manager (Recommended)

# Install packages from the registry
bp install docker-utils
bp install git-workflow

# Create your own packages
./tools/create-package.sh

Method 2: Local Modules

  1. Create a new file in the bash.d/ directory:

    touch bash.d/09-my-module.sh
  2. Add your configuration:

    # =============================================================================
    # My Custom Module
    # =============================================================================
    
    # Your aliases, functions, and settings here
    alias myalias='my command'
    
    myfunction() {
        echo "My custom function"
    }
  3. Enable the module:

    blm enable 09-my-module

Method 3: Local Overrides

Create ~/.bashrc.local for machine-specific settings that won't be tracked in version control:

# Machine-specific settings
export CUSTOM_VAR="value"
alias localalias="local command"

Creating Your Own Packages

Using the Package Creator Tool

# Run the interactive package creator
./tools/create-package.sh

This will guide you through creating:

  • Package metadata (name, description, version, etc.)
  • Script, function, or alias files
  • README documentation
  • Package configuration

Package Structure

packages/my-package/
├── my-package.sh      # Main package file
├── package.json       # Package metadata
└── README.md          # Documentation

Package Types

Script Package

# =============================================================================
# My Package
# =============================================================================

# Aliases
alias myalias='my command'

# Functions
myfunction() {
    echo "My function"
}

# Environment variables
export MY_VAR="value"

Function Package

# =============================================================================
# My Function
# =============================================================================

myfunction() {
    # Function logic here
    echo "Function called"
}

Alias Package

# =============================================================================
# My Alias
# =============================================================================

alias myalias='my_command_here'

Publishing Packages

  1. Create your package using the package creator tool
  2. Test locally by sourcing the package file
  3. Add to registry by updating the registry JSON file
  4. Share with community by contributing to the registry

Customization Examples

Custom Prompt

Edit bash.d/03-prompt.sh to modify your prompt:

# Simple prompt
PS1='\w\$ '

# Fancy prompt with colors
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Adding Language-Specific Aliases

Create bash.d/09-languages.sh:

# Python aliases
alias py='python3'
alias pip='pip3'
alias venv='python3 -m venv'

# Node.js aliases
alias nr='npm run'
alias ni='npm install'
alias nid='npm install --save-dev'

Adding Project-Specific Functions

Create bash.d/10-projects.sh:

# Quick project navigation
alias projects='cd ~/Projects'
alias work='cd ~/Projects/work'
alias personal='cd ~/Projects/personal'

# Project management functions
deploy() {
    echo "Deploying to production..."
    # Your deployment logic here
}

Performance Optimization

Quick Performance Actions

# Use the interactive UI for quick actions
./tools/load-manager-ui.sh

# Or use command line quick actions
blm quick minimal      # Minimal configuration
blm quick development  # Development configuration
blm quick production   # Production configuration

Performance Monitoring

# Regular performance checks
./tools/performance-monitor.sh startup
./tools/performance-monitor.sh modules
./tools/performance-monitor.sh report

# Set up performance alerts
# Add to your crontab to monitor regularly
# 0 */6 * * * ~/.bashie/tools/performance-monitor.sh report

Load Manager Configuration

The load manager uses a configuration file at ~/.bash-load-config:

# Format: module_name:enabled:priority
01-environment:1:1
02-aliases:1:2
03-prompt:1:3
04-functions:1:4
05-completion:1:5
06-example-extension:0:6
07-package-manager:1:7
08-load-manager:1:8

Troubleshooting

Load Manager Issues

  • Module not loading: Check if it's enabled in ~/.bash-load-config
  • Priority conflicts: Use blm priority to set correct priorities
  • Profile not working: Verify profile exists with blm profile list

Package Manager Issues

  • Package not found: Run bp update to refresh the registry
  • Installation fails: Check if dependencies are available
  • Package not loading: Verify the package file exists and is executable

Performance Issues

  • Slow startup: Use ./tools/performance-monitor.sh startup to measure
  • High memory usage: Disable unused modules with blm disable
  • Module conflicts: Check module priorities and dependencies

Module Not Loading

  • Check file permissions: chmod +x bash.d/*.sh
  • Verify syntax: bash -n bash.d/your-module.sh
  • Check for errors: source bash.d/your-module.sh

Completion Not Working

  • Ensure bash-completion is installed
  • Check if the completion function is properly registered
  • Verify the function name matches the command

Prompt Issues

  • Check terminal color support
  • Verify escape sequences are properly formatted
  • Test with a simple prompt first

Contributing

Contributing Packages

  1. Create a package using ./tools/create-package.sh
  2. Test thoroughly on different systems
  3. Document usage in the README
  4. Submit a pull request with your package

Contributing to Core

  1. Fork the repository
  2. Create a feature branch
  3. Add your improvements
  4. Test thoroughly
  5. Submit a pull request

Contributing Load Manager Features

  1. Performance improvements: Optimize module loading
  2. New profiles: Create useful default profiles
  3. UI enhancements: Improve the interactive interface
  4. Monitoring tools: Add new performance metrics

License

This configuration is provided as-is for personal use. Feel free to modify and distribute according to your needs.

Credits

This configuration draws inspiration from various bash configurations and best practices from the Unix/Linux community. The package manager concept is inspired by modern package managers like npm, pip, and cargo. The load manager is designed to address the common issue of slow bash startup times with heavily customized configurations.

About

A clean, modular bash configuration that provides essential functionality while remaining easy to extend and customize. **Now with a built-in package manager and load manager for optimal performance!

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages