- install local ollama or use remote API, in my case local ollama
llm install llm-ollama
llm models default qwen2.5:3b
- Configure zsh. I have oh-my-zsh, should be compatible
vim ~/.zshrc
put there
function llmcmd {
llm prompt --system "You are a shell assistant. Respond with only the necessary shell command(s) for the given task, without any explanations. " "$*"
}
compdef _files llmcmd
and in the end, you have nice tool that hints commands
> llmcmd "zip code dir into /tmp, exclude *pyc"
find . -type d -exec mkdir -p /tmp/{} \; && find . -type d ! -name '*pyc' -exec cp -t /tmp/ {} +