Skip to content

Instantly share code, notes, and snippets.

@kostasx
Created August 24, 2024 21:50
Show Gist options
  • Save kostasx/ef38a3a9642f343538000a080a5f3ee2 to your computer and use it in GitHub Desktop.
Save kostasx/ef38a3a9642f343538000a080a5f3ee2 to your computer and use it in GitHub Desktop.
Ollama Command Line Tricks (YouTube: https://youtu.be/7mw792o1sSg)
  • Input from stdin

    • ollama run llama3.1 "prompt"
  • Multiline input

    • Using """
  • Input from file

  • More fun with the pipe | operator

    • Passing the output of one LLM to another
      • ollama run llama3.1 "How do you make scrambled eggs?" | ollama run llama3.1 "Translate to german"
  • Output to a file

    • Output to a JSON file:
      • ollama run llama3.1 "Countries of Europe" --format json > europe.json
    • Appending to a file:
      • ollama run llama3 "Tell me a joke about programming" > jokes.md
      • ollama run llama3 "Tell me a joke about programming" >> jokes.md
  • Verbose output:

    • ollama run llama3.1 --verbose "What is the capital of Iceland?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment