Skip to main content

AI-powered CLI tool that converts natural language into Linux shell commands.

Project description

❯_ asksh

PyPI Python License: MIT

AI in your terminal for shell and coding help.

asksh is an AI-powered CLI that lets you describe what you want in plain English and get practical terminal guidance. In its default one-shot mode it replies with a concise Linux command. In explain or chat modes it can also provide short explanations or broader programming help.

You don't need to leave your terminal to get things done. Don't remember the exact tar flags? asksh

$ asksh "compress a directory as tar.gz excluding the .cache directory"
tar -czf archive.tar.gz --exclude=.cache my_directory

Important feature

  • Stay in the terminal: describe what you need in plain language and get a shell command (or a short explanation) without switching to a browser or another app.
  • Local model, low cost: Ollama with the default qwen2.5-coder is enough for most day-to-day terminal tasks—no API keys or token spend on large cloud providers.
  • No automatic access or execution: asksh does not browse your filesystem, write files, delete anything, or run shell commands on its own. It only sends your prompt to the model, plus text you explicitly provide with -f/--context or by piping stdin. You review and run any command yourself.

Features

  • One-shot command (default): returns just the shell command, no commentary.
  • Explain mode (-e/--explain): returns a command with a short explanation.
  • Interactive chat (-c/--chat, or run with no query): streamed multi-turn chat for broader help.
  • File context (-f/--context PATH): attach a file (logs, configs, code) as context.
  • Stdin support: pipe anything in (cat error.log | asksh ...), works in chat mode too.
  • Local & private: runs against your own Ollama server; no data leaves your machine.
  • Custom model / server: override defaults per call (--model, --base-url) or via a TOML config.

Quick Start

  1. Install Ollama and make sure it's running (ollama serve, or launch the desktop app).
  2. Pull the default model:
ollama pull qwen2.5-coder
  1. Install and run asksh:
pipx install asksh
asksh "find files larger than 500MB in this directory"

Safety

AI-generated shell commands can be destructive. Always review commands before running them, especially commands that remove files, rewrite git history, or modify system configuration.

Installation

Install the CLI

From PyPI:

pipx install asksh
# or: uv tool install asksh

From a clone (development):

git clone https://github.com/srgsol/asksh.git
cd asksh
uv sync
uv run asksh --help

Requires Python 3.10+ and a reachable Ollama server (see Quick Start).

Configuration (optional defaults)

CLI flags always win. To avoid retyping --model/--base-url on every run, drop a TOML file at:

  • $XDG_CONFIG_HOME/asksh/config.toml (or ~/.config/asksh/config.toml if XDG_CONFIG_HOME is unset), or
  • a custom path pointed to by ASKSH_CONFIG.

Only model and base_url are read from the config file. See config.example.toml.

Setting Default
model qwen2.5-coder
base_url http://localhost:11434

Usage

Flags

Flag Description
-c, --chat Start interactive chat (also the default when no query).
-e, --explain Return a command with a short explanation.
-f, --context PATH Use a file as additional context.
--model NAME Ollama model (default qwen2.5-coder).
--base-url URL Ollama server (default http://localhost:11434).
-V, --version Print version and exit.

Run asksh --help to see the full list.

One-shot query

asksh "compress this folder as tar.gz excluding .cache"

Interactive chat

asksh enters chat mode if no query is provided, or when -c/--chat is set.

asksh
# or:
asksh -c

Explain mode

Return a command with a short explanation:

asksh -e "show open tcp ports"

Context file

Pass a file as additional context:

asksh -f error.log "what is failing here?"

Pipe stdin

Use piped input as context:

cat data.json | asksh "use jq to count items"

You can combine stdin with chat mode — stdin becomes the first message and the chat then continues interactively from your terminal:

cat error.log | asksh -c "what went wrong?"

Troubleshooting

  • Cannot connect to Ollama: ensure Ollama is running and reachable at http://localhost:11434 (or pass --base-url).
  • Model not found: run ollama pull qwen2.5-coder or pass another available model with --model.
  • Config not being used: verify config path ($XDG_CONFIG_HOME/asksh/config.toml or ~/.config/asksh/config.toml) and check ASKSH_CONFIG if set.

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

asksh-0.2.2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

asksh-0.2.2-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file asksh-0.2.2.tar.gz.

File metadata

  • Download URL: asksh-0.2.2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for asksh-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7aab8007779408eb83b30663f5b5a05e29f8096b7b15c3018ec4ff77d3b26e25
MD5 dd00dad8bbc51a9444f1e245312a3113
BLAKE2b-256 23f90caf53d236aab77a759cb73473ecc9367c9d7618a0ff4e735b31ec2ee2d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for asksh-0.2.2.tar.gz:

Publisher: publish.yml on srgsol/asksh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asksh-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: asksh-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for asksh-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d709748143e1c5647ae46fddbeeee11f6f9a0207c7136a6c85013ba89cec3df
MD5 76bb1d0a04fb52937ba13c3bcc09a26c
BLAKE2b-256 8af634ba451c0186d7b6d1231773f63a5bf7d7d6d9f660e148d361d825d80384

See more details on using hashes here.

Provenance

The following attestation bundles were made for asksh-0.2.2-py3-none-any.whl:

Publisher: publish.yml on srgsol/asksh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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