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 - Quick Directory Bookmarks: Save and jump to frequently used directories with the
bookmarkcommand - 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)"After installation, you can configure a custom shortcut for the bookmark command (e.g., bm) by editing ~/.mylinuxhelper/mlh.conf and setting BOOKMARK_ALIAS=bm, then running setup.sh in the installation directory to apply changes.
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]: 1π‘ Note:
mlh docker inautomatically detects if Docker requires sudo permissions and usessudo dockerwhen needed. You don't need to runsudo mlh docker in- just runmlh docker in <pattern>and it will handle sudo automatically if required.
β οΈ Troubleshooting: If you getmlh: command not foundwhen runningsudo mlh docker in, it's becausesudoresets the PATH. Solutions:
- Recommended: Run without sudo:
mlh docker in <pattern>(script handles sudo internally)- Alternative: Use
sudo -E env PATH=$PATH mlh docker in <pattern>to preserve PATH- Best long-term: Add your user to the docker group:
sudo usermod -aG docker $USER(then logout/login)
Launch 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 mycontainerSave and jump to frequently used directories instantly:
π‘ Configurable Shortcut: Configure your preferred alias (e.g.,
bm,fav,goto) in~/.mylinuxhelper/mlh.conf:BOOKMARK_ALIAS=bmThen run
./setup.shto apply. The alias works with all bookmark features!
Usebm --helpto see examples with your configured shortcut.
# Save current directory (numbered bookmark)
bookmark . # or: bm .
# Jump to bookmark 1 (most recent)
bookmark 1 # or: bm 1
# Save with a memorable name
bookmark . -n myproject # or: bm . -n myproject
# Jump to named bookmark
bookmark myproject # or: bm myproject
# Save with category for organization
bookmark . -n mlh in projects/linux # or: bm . -n mlh in projects/linux
bookmark . -n api in projects/java # or: bm . -n api in projects/java
# List all bookmarks (interactive TUI by default)
bookmark list # or: bm list
# Non-interactive simple output
bookmark list -n # or: bm list -n
# List specific category
bookmark list projects # or: bm list projects
# Move bookmark to different category
bookmark mv mlh to tools # or: bm mv mlh to tools
# Show last 5 numbered bookmarks
bookmark list 5 # or: bm list 5
# Rename numbered bookmark
bookmark 1 -n webapp # or: bm 1 -n webapp
# Edit bookmark (name/path/category)
bookmark edit mlh # or: bm edit mlh
# Remove bookmark
bookmark rm oldproject # or: bm rm oldproject
bookmark rm 3 # or: bm rm 3
# Search bookmarks
bookmark find java # or: bm find java
# Clear all numbered bookmarks
bookmark clear # or: bm clear
# View help (dynamically shows your configured shortcut)
bookmark --help # or: bm --helpKey Features:
- Configurable shortcut alias: Use
bm(or your preferred shortcut) instead of typingbookmarkevery time! Configure in~/.mylinuxhelper/mlh.conf - Stack-based numbered bookmarks: Quick access to last 10 directories (auto-rotating, auto re-numbering)
- Named bookmarks: Save important locations with memorable names
- Hierarchical categories: Organize bookmarks (e.g.,
projects/linux,projects/java) - Interactive menu by default: Navigate with arrow keys, edit, delete, search in real-time (
bookmark list- no-iflag needed!) - Category filtering: List bookmarks by category
- Smart search: Find bookmarks by name, path, or category (
bookmark find <pattern>) - Path validation: Warns when bookmark path no longer exists
- Name conflict detection: Prevents conflicts with system commands (both for bookmarks and aliases)
- Bookmark management: Edit, remove, clear bookmarks easily
- Instant navigation: Jump to bookmarks without typing full paths
- JSON storage: Bookmark data stored at
~/.mylinuxhelper/bookmarks.json - Dynamic help: Help messages automatically adapt to show your configured shortcut
View 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/
βββ get-mlh.sh # Bootstrap installer (downloads repo)
βββ setup.sh # Main setup script (creates symlinks, configures PATH)
βββ install.sh # Universal package installer (provides 'i' command)
βββ README.md # User documentation with usage examples
βββ LICENSE # Project license
βββ plugins/
β βββ mlh.sh # Interactive menu and command dispatcher
β βββ mlh-bookmark.sh # Quick directory bookmarks (JSON-based, category support)
β βββ 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
β βββ bookmark-alias.sh # Bookmark alias proxy (delegates to mlh-bookmark.sh)
β βββ ll.sh # Shortcut for "ls -la"
βββ docs/
β βββ config/
β βββ mlh.conf.example # Example configuration file
MyLinuxHelper includes a comprehensive test suite with 293 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
./tests/test shellcheck
# Run bookmark tests (subdirectory)
./tests/test bookmark/mlh-bookmark
./tests/test bookmark/bookmark-alias
./tests/test bookmark/bookmark-alias-integrationβ 293 total tests with 288 passed (98.3% success rate)
Note: Some tests gracefully skip if dependencies are missing (e.g.,
jqfor JSON tests,shellcheckfor code quality tests,tmuxfor interactive tests).
Test Suites:
- bookmark/mlh-bookmark.sh (80 tests) - Bookmark functionality, interactive mode, categories
- bookmark/bookmark-alias.sh (28 tests) - Alias configuration and validation
- bookmark/bookmark-alias-integration.sh (13 tests) - Alias integration with setup.sh
- 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
- shellcheck (6 tests) - Code quality validation (requires shellcheck)
- current-session (1 test) - Session history tracking
- β
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/*.shCode Quality:
- β ShellCheck Compliance: All scripts pass ShellCheck validation (automated test suite)
- β
Formatting: All scripts formatted with
shfmtfor consistency - β
Best Practices: Proper error handling with
set -euo pipefail - β Clean Syntax: No unused variables, proper quoting, safe command execution
The test suite includes automated ShellCheck validation to ensure code quality across all scripts.
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.

