A lightweight and modular collection of utility tools to simplify your Linux experience.
- Interactive Command Menu: Browse and explore all commands with the
mlhinteractive menu - Smart Docker Management: Quickly enter running containers by name pattern with
mlh docker in - Enhanced Command History: View command history with dates, search commands, and filter by date range using
mlh history - Fast File Search: Find files quickly in current directory and subdirectories with the
searchcommand - Isolated Linux Containers: Quickly launch and manage Linux containers with the
linuxcommand - Smart Package Manager: Automatically detects and uses apt, yum, dnf, or other package managers with the
icommand - Advanced JSON Operations: Validate and search JSON files with fuzzy matching and intelligent path navigation
- Enhanced Directory Listing: View detailed file and directory information with the
llcommand (ls -la shortcut) - Lightweight and modular plugin system
- Easy installation and usage
- Extensible architecture for adding custom commands
Run the command below:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/melihcelenk/MyLinuxHelper/main/get-mlh.sh)" \
|| bash -c "$(wget -qO- https://raw.githubusercontent.com/melihcelenk/MyLinuxHelper/main/get-mlh.sh)"Browse all available commands interactively:
# Show interactive menu
mlh
# Show version
mlh -v
mlh --version
# Docker shortcuts
mlh docker in <pattern>Interactive Menu Example:
MyLinuxHelper - Available Commands
===================================
1. linux <name> - Create and manage Linux containers
2. i <package> - Install packages (auto-detects package manager)
3. isjsonvalid <file.json> - Validate JSON files
4. ll [path] - Enhanced directory listing (ls -la)
5. mlh docker in <pattern> - Enter running Docker container
Select [1-5, q]:
Enter running Docker containers by name pattern:
# Enter container by name
mlh docker in web
# If multiple containers match, shows interactive menu:
# Multiple containers found matching 'mycontainer':
#
# 1. mycontainer-web (nginx:latest | Up 2 hours)
# 2. mycontainer-api (node:18 | Up 2 hours)
# 3. mycontainer-db (postgres:14 | Up 2 hours)
#
# Select container [1-3]: 1Launch and manage isolated Linux containers quickly:
# Create ephemeral container (auto-removed on exit)
linux mycontainer
# Create permanent container
linux -p mycontainer
# Stop container
linux -s mycontainer
# Delete container
linux -d mycontainer
# Use different base image
linux -i debian:12 mycontainer
# Bind mount directory
linux -m "$PWD:/workspace" -p mycontainerView command history with dates, search, and filtering:
# Show last 100 commands (default)
mlh history
# Show all history
mlh history -a
# Show last 10 commands
mlh history 10
# Show detailed history with colors and formatting
mlh history -d
# Search for commands containing "docker"
mlh history -f docker
# Show specific command by number
mlh history -g 1432
# Show commands from specific date
mlh history -t 2025-10-20
# Show commands in date range
mlh history -t 2025-10-18..2025-10-20
# Configure settings (default limit, date tracking, display mode)
mlh history -cKey Features:
- Current session support: Automatically includes commands from current session via wrapper function
- Smart defaults: Shows last 100 commands by default (configurable)
- Show all: Use
-ato display entire history - Date tracking: Shows when each command was executed (configurable)
- Search functionality: Find commands by pattern with
mlh history -f <pattern> - Direct access: Jump to specific command with
mlh history -g <number> - Date filtering: Filter by date or date range with
mlh history -t <date> - Relative time support: Use formats like
3d,20m,2hfor recent commands - Before offset: Specify time offset with
-bflag (e.g.,-t 20m -b 1h) - Multiple display modes: Simple (numbered with dates), Detailed (formatted), Minimal (plain)
- Configurable defaults: Set default limit, display mode, and enable/disable date tracking
- Helpful messages: When no results found, shows latest command timestamp with suggestions
- Non-intrusive: Doesn't affect the system
historycommand
Automatically detects your package manager (apt, yum, dnf, etc.) and installs packages:
# Install a package
i nginx
# Install multiple packages
i git curl wget
# Show help
i --helpAdvanced JSON validation and fuzzy search with intelligent path navigation:
# Quick validation (Yes/No output)
isjsonvalid data.json
# Output: Yes
# Detailed validation
isjsonvalid -d data.json
mlh json --isvalid data.json
# Output: β Valid JSON
# Search for a field (fuzzy match, case-insensitive)
mlh json get name from users.json
# Output: "users"."name": "John"
# Partial key matching - finds "RequestedTags" with just "req"
mlh json get req from config.json
# Output: "RequestedTags": [...]
# Search with path hint (targeted search, no menu)
mlh json get settings.lang from config.json
# Output: "settings"."language": "en"
# Multiple matches - shows interactive menu
mlh json get user from data.json
# Found 3 matches for 'user':
# 1. "users": [...]
# 2. "username": "john"
# 3. "userProfile"."userId": "123"
# Show help
mlh json --helpKey Features:
- Centralized validation: Both
isjsonvalidandmlh json --isvaliduse the same engine - Flexible output modes: Quick (Yes/No) or detailed (with colors and error messages)
- Searches ALL JSON keys (arrays, objects, scalars)
- Fuzzy and partial matching (e.g.,
reqβRequestedTags) - Path hints for targeted search
- Interactive menu for multiple matches
- Auto-installs
jqif needed
Shortcut for ls -la to view detailed file information:
# List current directory
ll
# List specific directory
ll /var/log
# List with pattern
ll *.jsonFind files quickly in current directory and subdirectories:
# Search for file by name
search myfile
# Search for files with wildcard pattern
search "*.json"
# Search in specific directory
search config.js ./src
# Search for configuration files in /etc
search "*.conf" /etc/
βββ setup.sh # Main setup script
βββ install.sh # Universal package installer
βββ plugins/
β βββ mlh.sh # Interactive menu and command dispatcher
β βββ mlh-docker.sh # Docker shortcuts and container management
β βββ mlh-history.sh # Enhanced command history with dates, search, and filtering
β βββ mlh-json.sh # Advanced JSON search (delegates validation to isjsonvalid.sh)
β βββ mlh-version.sh # Version management and auto-update system
β βββ mlh-about.sh # Project information and about page
β βββ linux.sh # Launch and manage Docker containers
β βββ search.sh # Fast file search using find
β βββ isjsonvalid.sh # Centralized JSON validation with flexible output modes
β βββ ll.sh # Shortcut for "ls -la"
βββ tests/
βββ test # Main test runner (161 tests)
βββ test-mlh-history.sh # 34 tests - Command history
βββ test-linux.sh # 15 tests - Container management
βββ test-mlh-json.sh # 18 tests - JSON operations
βββ test-mlh-docker.sh # 18 tests - Docker shortcuts
βββ test-mlh.sh # 20 tests - Main dispatcher
βββ test-search.sh # 16 tests - File search
βββ test-isjsonvalid.sh # 18 tests - JSON validation
βββ test-ll.sh # 10 tests - Directory listing
βββ test-mlh-about.sh # 12 tests - About page
MyLinuxHelper includes a comprehensive test suite with 161 tests covering all major functionality.
# Run all tests
./tests/test
# Run specific test suite
./tests/test mlh-history
./tests/test mlh-docker
./tests/test mlh-json
./tests/test linux
./tests/test search
./tests/test isjsonvalid
./tests/test ll
./tests/test mlh-about
./tests/test mlhβ 161 total tests with 100% success rate (0 failing tests)
Note: 8 tests in
mlh-json.shgracefully skip ifjqis not installed. Withjqinstalled, all 161 tests pass.
Completed Test Suites:
- mlh-history.sh (34 tests) - Command history, time parsing, filtering
- linux.sh (15 tests) - Container management, Docker commands
- mlh-json.sh (18 tests) - JSON search, validation, fuzzy matching
- mlh-docker.sh (18 tests) - Container access, pattern matching
- mlh.sh (20 tests) - Main dispatcher, routing, interactive menu
- search.sh (16 tests) - File search, wildcards, error handling
- isjsonvalid.sh (18 tests) - JSON validation engine, output modes
- ll.sh (10 tests) - Directory listing wrapper
- mlh-about.sh (12 tests) - Project information display
- β
SKIP Support: Tests gracefully skip when dependencies (like
jq) are missing - β Syntax Error Detection: Pre-validates test files before running to catch CRLF and syntax issues
- β Color-coded Output: Green (PASS), Yellow (SKIP), Red (FAIL) for easy reading
- β Detailed Summary: Shows Total, Passed, Skipped, Failed counts
- β Modular Design: Easy to add new test suites for plugins
The codebase follows shell scripting best practices:
# Format all scripts with shfmt
shfmt -w .
# Check for common issues
shellcheck plugins/*.sh tests/*.shShellCheck Compliance:
- β All SC2155 warnings fixed (separate declare and assign)
- β No unused variables
- β
Proper error handling with
set -euo pipefail - β Clean syntax validation
See TEST_PLAN.md for detailed testing strategy and PROGRESS.md for current status.
MyLinuxHelper uses shfmt for consistent shell script formatting:
# Install shfmt (if not already installed)
# macOS
brew install shfmt
# Linux
go install mvdan.cc/sh/v3/cmd/shfmt@latest
# Format all scripts
shfmt -w .
# Check formatting without modifying
shfmt -d .Formatting Standards:
- Indentation: Tabs
- Binary operators: Spaces around operators
- Redirect operators: No space before redirect
- Case indent: Aligned with case keyword
# Run ShellCheck on all scripts
shellcheck plugins/*.sh tests/*.sh
# Run tests after formatting
./tests/test
# Verify all tests pass
echo $? # Should be 0-
Create a new test file in
tests/:tests/test-<plugin-name>.sh
-
Follow the existing test structure:
#!/usr/bin/env bash # Disable strict mode for tests set +euo pipefail 2>/dev/null || true set +e PLUGIN_SCRIPT="$ROOT_DIR/plugins/<plugin-name>.sh" # Test 1: Script exists if [ -f "$PLUGIN_SCRIPT" ]; then print_test_result "<plugin-name>.sh exists" "PASS" else print_test_result "<plugin-name>.sh exists" "FAIL" fi
-
Run the new test:
./tests/test <plugin-name>
If you see syntax errors due to Windows line endings (CRLF):
# Fix a single file
sed -i 's/\r$//' tests/test-<name>.sh
# Fix all test files
find tests/ -name "*.sh" -exec sed -i 's/\r$//' {} \;
# Verify fix
file tests/test-<name>.sh
# Should show: "ASCII text executable" (not "with CRLF")The test runner automatically detects syntax errors and shows helpful fix commands.