A CLI tool that translates natural language into Linux shell commands, helps users understand them, and optionally runs them.
go-linux (also known as lihelp) is designed to assist new Linux users by converting plain English descriptions into executable shell commands. It leverages AI (via Google's Generative AI) to generate accurate commands based on user queries, provides clear explanations, and offers the option to execute the commands directly. This tool is particularly useful for beginners who are learning Linux command-line operations.
- Natural Language to Command Translation: Input a description like "list all files in the current directory" and get the corresponding
lscommand. - Command Explanation: Each generated command comes with a detailed explanation to help users learn.
- Optional Execution: Choose to run the command or just view it (with dry-run mode available).
- Command Logging: Keeps a history of generated commands for reference.
- Monitoring Mode: Run in monitor mode to get system information.
- Safe Mode: Shows warnings and reasoning before executing any hostile command.
- Ensure you have Go installed (version 1.24 or later). You can download it from golang.org.
- Clone the repository:
git clone https://github.com/kairavb/go-linux.git cd go-linux - Install dependencies:
go mod tidy
To build the executable:
go build -o lihelp .-
Running lihelp without arguments:
./lihelp
-
Gives output, (Updated)
Error: requires at least 1 arg(s), only received 0 Usage: lihelp [description] [flags] lihelp [command] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command history Show and interact with command history Flags: -d, --dry-run Preview command without running -h, --help help for lihelp -m, --monitor Show system monitor info
You can run the tool directly using Go:
go run . "list all files in the current directory"Or after building:
./lihelp "list all files in the current directory"-
Generate a command without running it:
./lihelp "show disk usage" -
Use dry-run mode (command not executed):
./lihelp --dry-run "create a new directory called test" -
Run in monitor mode (for continuous command generation):
./lihelp --run-monitor
--dry-runor-d: Generate and explain the command but do not execute it.--run-monitoror-m: Enable monitoring mode for ongoing command assistance.
- Beginners often struggle with remembering commands and flags
- Fear of breaking the system discourages experimentation
- lihelp encourages learning
- Explaining commands clearly
- Allowing safe previews before execution
- Keeping a history for revision
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.