Skip to content

Instantly share code, notes, and snippets.

@tkellogg
Last active November 15, 2024 22:56
Show Gist options
  • Save tkellogg/fb4bef616eed7ac383a1e4616db91e8e to your computer and use it in GitHub Desktop.
Save tkellogg/fb4bef616eed7ac383a1e4616db91e8e to your computer and use it in GitHub Desktop.
Ollama zsh aliases
# Standard usage. The name of the model is stored in `~/.default-model`
alias oll="ollama run $(cat ~/.default-model)"
# Ask a question about whatever is on your clipboard (works on OS X)
alias olp='ollama run $(cat ~/.default-model) "$1
$(pbpaste)"'
# Same as oll, but just get to the point. Great for those "what am i thinking of?" kind of questions
alias ols='ollama run $(cat ~/.default-model) "$1\n\nAnswer succinctly in as few words as possible"'

ZSH/BASH aliases

My zsh aliases for working with Ollama. This is intended for macos.

It reads the model name from a file, because my LLM preferences are a lot more volatile than the lifetime of my terminal windows.

Install

First, get ollama:

brew install ollama

Copy .zshrc and add it to your ~/.zshrc:

pbpaste >> ~/.zshrc

Make the ~/.default-model file:

echo 'qwen2.5' > ~/.default-model

Alias: oll

Standard usage. Prompt the default model.

Alias: ols

Same as oll but answer succinctly.

❯ ols "What's the builder tool for node.js that is a packager"
webpack

Alias: olp

Ask a question about whatever is on your clipboard. I typically use it in combination with pbcopy, like:

❯ ls -lathr /Volumes | pbcopy
❯ olp "When did I plug in the external HD?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment