❯_ 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? asksh
$ asksh "compress a directory as tar.gz excluding the .cache directory"
tar -czf archive.tar.gz --exclude=.cache my_directory
Why asksh
- 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. - Re-render last reply (
-m/--markdown): reprint the previous assistant reply as Markdown, offline (no Ollama call). - 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. - Thinking models: reasoning is enabled automatically for supported models; pass
--think falseto disable (see below).
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).
Only model, base_url, update_check, and the per-mode render style are read from the config file. See config.example.toml.
| Setting | Default |
|---|---|
model |
qwen2.5-coder |
base_url |
http://localhost:11434 |
update_check |
true |
oneshot_render |
text |
explain_render |
text |
chat_render |
text |
Render style
ONESHOT_RENDER / EXPLAIN_RENDER / CHAT_RENDER (config-only, no CLI flag) each pick one of:
text— stream as plain text (the only copy).markdown— show a spinner/preview while tokens arrive, then print the whole reply as Markdown once, when it completes.post_markdown— stream as plain text, then print a second Markdown copy of the same reply below it.live_markdown— live Markdown preview, redrawn as tokens arrive, then one final Markdown print. Resizing or scrolling the terminal mid-stream can garble the live preview (the final print is always clean); accept that trade-off only if you want live-formatted Markdown while it streams.
An invalid value is ignored with a warning; the mode's default (above) is used instead.
At startup, asksh checks PyPI for a new release (at most once per 24h, cached in $XDG_CACHE_HOME/asksh/update_check). If one exists it prints a one-line notice with the upgrade command; the check never fails startup and is skipped entirely when offline. Disable it with UPDATE_CHECK = false in the config or the --no-update-check flag.
Usage
Flags
| Flag | Description |
|---|---|
-c, --chat |
Start interactive chat (also the default when no query). |
-e, --explain |
Return a command with a short explanation. |
-m, --markdown |
Re-render the last assistant reply as Markdown (no Ollama call). |
-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). |
--think LEVEL |
Control reasoning for thinking models (true, false, low, medium, high, max; enabled when supported if omitted). |
--show-thinking |
Show the model reasoning trace (requires --think other than false). |
--no-update-check |
Skip the startup PyPI update check. |
-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
By default (CHAT_RENDER = "text"), replies stream append-only: finished lines are printed once and become part of the terminal's normal scrollback, so mouse-wheel scrolling and window resizing behave exactly as with any other command's output — this guarantee holds for the text, markdown, and post_markdown render styles alike (only live_markdown redraws in place and can desync on resize/scroll; see Render style). Press Ctrl-C to abort the stream; whatever was already printed stays on screen (it cannot be un-printed), but the partial reply is not added to the conversation history.
Explain mode
Return a command with a short explanation:
asksh -e "show open tcp ports"
Re-render the last reply as Markdown
asksh saves the most recent assistant reply (from one-shot, explain, or chat mode) to $XDG_STATE_HOME/asksh/last_reply (fallback ~/.local/state/asksh/last_reply). Reprint it as formatted Markdown, offline, with no query and no Ollama call:
asksh -m
-m/--markdown cannot be combined with -c/--chat, -e/--explain, or a query.
Thinking models
Models such as DeepSeek R1 or Qwen 3 can emit a separate reasoning trace. When --think is omitted, asksh enables reasoning only for models that support it. To disable reasoning:
asksh --think false "compress this folder as tar.gz"
Passing --think true (or a level such as medium or high) on a model that does not support thinking exits with an error. The reasoning trace is shown automatically when thinking is enabled; use --show-thinking to force it on.
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).
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-1.1.0.tar.gz.
File metadata
- Download URL: asksh-1.1.0.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d23d9e2f49e02c2a601072e9eec25bf2293d03f620a5ccb3eeb35d9a545de5e0
|
|
| MD5 |
312cbf2a2397c222a9b5ea7a003fc668
|
|
| BLAKE2b-256 |
7fcdbb3d0258b99ee5b19d943bc14c7025debe89f3657815aebc5ef9f54527f0
|
Provenance
The following attestation bundles were made for asksh-1.1.0.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-1.1.0.tar.gz -
Subject digest:
d23d9e2f49e02c2a601072e9eec25bf2293d03f620a5ccb3eeb35d9a545de5e0 - Sigstore transparency entry: 2532054348
- Sigstore integration time:
-
Permalink:
srgsol/asksh@59260c7e04685b35479226c6ebf587ab0cc892e1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/srgsol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@59260c7e04685b35479226c6ebf587ab0cc892e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file asksh-1.1.0-py3-none-any.whl.
File metadata
- Download URL: asksh-1.1.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe85bf8b39919be13d64016860cc8b3b6666826fd905874e824a220fe5054209
|
|
| MD5 |
a000aafe7f7ffae829f967a66504e80b
|
|
| BLAKE2b-256 |
107f782acb17b39c371fe6312aafa3d05206298e6ee3e77a3afc395ddba1cf21
|
Provenance
The following attestation bundles were made for asksh-1.1.0-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-1.1.0-py3-none-any.whl -
Subject digest:
fe85bf8b39919be13d64016860cc8b3b6666826fd905874e824a220fe5054209 - Sigstore transparency entry: 2532055045
- Sigstore integration time:
-
Permalink:
srgsol/asksh@59260c7e04685b35479226c6ebf587ab0cc892e1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/srgsol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@59260c7e04685b35479226c6ebf587ab0cc892e1 -
Trigger Event:
push
-
Statement type: