AI-powered CLI tool that converts natural language into Linux shell commands.
Project description
asksh
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? Ask asksh.
$ asksh "compress a directory as tar.gz excluding the .cache directory"
tar -czf archive.tar.gz --exclude=.cache my_directory
Important features
- 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-coderis enough for most day-to-day terminal tasks—no API keys or token spend on large cloud providers. - No automatic access or execution:
askshdoes 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/--contextor 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
- Install Ollama and make sure it's running (
ollama serve, or launch the desktop app). - Pull the default model:
ollama pull qwen2.5-coder
- 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.tomlifXDG_CONFIG_HOMEis 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-coderor pass another available model with--model. - Config not being used: verify config path (
$XDG_CONFIG_HOME/asksh/config.tomlor~/.config/asksh/config.toml) and checkASKSH_CONFIGif 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asksh-0.2.1.tar.gz.
File metadata
- Download URL: asksh-0.2.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c78735325396a4d95bc4cde75026a9f1b82534df28e73d781c8e0ac3f3f70a88
|
|
| MD5 |
669bd25dd8b8d1a7ee50ac7da71672ad
|
|
| BLAKE2b-256 |
b45baaf6bd7fa765dfa4922ea289e138683a6122d6ec2354cf2aa9e270344c89
|
Provenance
The following attestation bundles were made for asksh-0.2.1.tar.gz:
Publisher:
publish.yml on srgsol/asksh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asksh-0.2.1.tar.gz -
Subject digest:
c78735325396a4d95bc4cde75026a9f1b82534df28e73d781c8e0ac3f3f70a88 - Sigstore transparency entry: 1463585176
- Sigstore integration time:
-
Permalink:
srgsol/asksh@1c0c1d46a564b9eb9c67775f983f7eb7f93412dc -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/srgsol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c0c1d46a564b9eb9c67775f983f7eb7f93412dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file asksh-0.2.1-py3-none-any.whl.
File metadata
- Download URL: asksh-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ec9f6f358a6af235d6729f36a776c0710a8d78d261be5818cdc972874570cd
|
|
| MD5 |
ea58cb46473888a216b358835db072c0
|
|
| BLAKE2b-256 |
5380ec636987ec4f43f26d2f25f1032849f65cf4aae08a5bb15f3b28db4f1b5f
|
Provenance
The following attestation bundles were made for asksh-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on srgsol/asksh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asksh-0.2.1-py3-none-any.whl -
Subject digest:
d6ec9f6f358a6af235d6729f36a776c0710a8d78d261be5818cdc972874570cd - Sigstore transparency entry: 1463585204
- Sigstore integration time:
-
Permalink:
srgsol/asksh@1c0c1d46a564b9eb9c67775f983f7eb7f93412dc -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/srgsol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c0c1d46a564b9eb9c67775f983f7eb7f93412dc -
Trigger Event:
push
-
Statement type: