Skip to main content

Natural language to shell commands. Local. Private. Free.

Project description

Gnix

Gnix

Natural language to shell commands. Local. Private. Free.

Python License Ollama


Gnix converts natural language into shell commands, running entirely on your machine. No API key. No internet. No privacy concerns. Just you, your terminal, and a local AI model.

$ gnix "find all python files modified in the last 7 days"

  │  shell   zsh
  │  model   qwen2.5:0.5b

  ▸  find all python files modified in the last 7 days

  ✦  Command
     find . -name '*.py' -mtime -7

  ▸  Finds all Python files in the current directory modified within the last 7 days.

  run this command? [y/n]: y

Why Gnix

Every similar tool requires an API key and sends your commands to a remote server. Gnix is different.

Feature ShellGPT AI Shell Gnix
Runs locally
No API key
No internet required
Private by default
Free forever
Safety layer
Bash and Zsh support

Installation

1 — Install Ollama

Gnix uses Ollama to run AI models locally.

curl -fsSL https://ollama.com/install.sh | sh

2 — Pull a model

# Lightweight — works on any machine (400MB)
ollama pull qwen2.5:0.5b

# Better quality — needs 4GB RAM (2.2GB)
ollama pull phi3.5

Browse all available models at ollama.com/library

3 — Install Gnix

pip install gnix

4 — Run

gnix "list all files larger than 1GB"

On first run, Gnix will guide you through selecting a model.


Usage

Generate and run a command

gnix "show disk usage of current folder"
gnix "find all log files older than 30 days"
gnix "list all running processes sorted by memory"
gnix "count lines in all python files"
gnix "create a compressed backup of the src folder"

Explain a command

gnix --explain "tar -czf archive.tar.gz /home/user"
gnix --explain "find / -size +1G -type f 2>/dev/null"

Dry run — generate without executing

gnix --dry-run "delete all temp files older than 7 days"

Change model

gnix --set-model

Safety

Gnix has a built in safety layer that detects dangerous commands before they run.

Dangerous commands always require explicit confirmation:

$ gnix "delete everything in the current folder"

  ✦  Command
     rm -rf *

  ▲  WARNING
  This command will recursively delete everything in the current
  directory and cannot be undone.

  type yes to confirm:

Patterns that trigger warnings:

  • Recursive deletion — rm -rf /, rm -rf ~, rm -rf *
  • Disk wiping — dd if=, > /dev/sda
  • Filesystem formatting — mkfs, mke2fs
  • Dangerous permissions — chmod -R 777 /
  • Fork bombs — :(){ :|:& };:
  • Remote script execution — curl | bash, wget | sh
  • System file overwriting — > /etc/passwd, > /etc/shadow
  • System shutdown — shutdown, reboot, halt

How It Works

User types natural language
           │
           ▼
    Input validation
           │
           ▼
    Shell detection (bash / zsh)
           │
           ▼
    Local AI model via Ollama
    (runs entirely on your machine)
           │
           ▼
    Generated shell command
           │
           ▼
    Safety checker
    ┌────────┴────────┐
    │                 │
  Safe           Dangerous
    │                 │
    ▼                 ▼
  Explain          Warn user
  command          ask for
    │              confirmation
    ▼                 │
  Ask [y/n] ←────────┘
    │
    ▼
  Execute and show output

Supported Models

Any model available in Ollama works with Gnix. Recommended options:

Model Size RAM needed Quality
qwen2.5:0.5b 400MB 1GB Good for most tasks
qwen2.5:1.5b 1GB 2GB Better quality
phi3.5:latest 2.2GB 4GB Best quality
llama3.2:3b 2GB 4GB Strong at reasoning

Switch models anytime with gnix --set-model.


Project Structure

gnix/
├── gnix/
│   ├── cli.py         — entry point, argument parsing
│   ├── model.py       — Ollama integration, command generation
│   ├── safety.py      — dangerous command detection
│   ├── executor.py    — command execution
│   ├── explain.py     — command explanation
│   ├── config.py      — user config, first run setup
│   └── display.py     — colors, symbols, spinner, UI
├── training/
│   ├── dataset.ipynb  — dataset preparation
│   ├── train.ipynb    — fine-tuning pipeline
│   └── README.md
├── tests/
│   ├── test_safety.py
│   ├── test_model.py
│   ├── test_config.py
│   └── test_executor.py
├── setup.py
└── requirements.txt

Running Tests

pip install pytest
pytest tests/ -v

Contributing

Contributions are welcome. Open an issue or submit a pull request.


License

Apache 2.0 — see LICENSE


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnix-0.1.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gnix-0.1.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file gnix-0.1.0.tar.gz.

File metadata

  • Download URL: gnix-0.1.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gnix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 adec863f5098607aa684ed3add2d8174a736a277626d3e028667c8383ca1e746
MD5 e79cb4a007e5fc765368742a91af2f97
BLAKE2b-256 4cada95e04fb257ae903cd116d4f0b102825c6ccd5d53aac3f0068deb2623aa0

See more details on using hashes here.

File details

Details for the file gnix-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gnix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for gnix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e2ab40977b82347700ef999308a9fc045eaf19ce8b8d4abd97d2141e67bc94d
MD5 442367e39b73f08ad79621d464b40ade
BLAKE2b-256 447cabf547135154c7519ab590a1d6ba8d855da59b3b37d7538e3c19fb7db463

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page