Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Ollama Commands: The Complete Cheat Sheet With Examples

    October 23, 2026

    Best Local AI Video Editors: Edit With AI on Your Own Computer

    October 22, 2026

    Best Hardware for Local LLMs in 2026: GPUs, Macs and AI Mini PCs Compared

    October 22, 2026
    Facebook X (Twitter) Instagram
    contact@techiehub.blog
    Facebook Instagram LinkedIn
    TechiehubTechiehub
    • Home
    • Featured
    • Latest Posts
    • Latest in Tech
    • Blog
    • About Us
    • Contact Us
    TechiehubTechiehub
    Home - Latest in Tech - Ollama Commands: The Complete Cheat Sheet With Examples
    Latest in Tech

    Ollama Commands: The Complete Cheat Sheet With Examples

    HamzaBy HamzaNo Comments8 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Close-up of code on a dark screen, like running Ollama commands in a terminal
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Ollama is the quickest way to run open language models on your own computer, and almost everything you do with it happens through a short list of terminal commands. This page collects them in one place: managing models, chatting and scripting, the flags that change how a model runs, server settings, custom models and the local API. Keep it open next to your terminal. If you are installing Ollama for the first time, start with our Ollama tutorial for beginners and come back here.

    Quick answer: the Ollama commands you will use most are ollama run <model> to chat (it downloads the model if needed), ollama pull to download, ollama ls to list installed models, ollama ps to see what is loaded and whether it is on the GPU, ollama stop to unload a model, ollama rm to delete one and ollama serve to start the server. Type ollama help for the full list on your version.

    Table of Contents

    1. Ollama commands at a glance
    2. Running models and the most useful flags
      1. Slash commands inside a chat
      2. Inspecting a model with ollama show
    3. Managing memory with ollama ps and ollama stop
    4. Server settings and environment variables
    5. Custom models with a Modelfile
    6. Calling Ollama from code
    7. Fixing common Ollama problems
    8. How one analyst scripted a daily summary
    9. Frequently Asked Questions
      1. What are the basic Ollama commands?
      2. What does ollama ps show?
      3. How do I stop or unload a model in Ollama?
      4. Where does Ollama store models?
      5. How do I increase the context length in Ollama?
      6. Is there a GUI for Ollama?
    10. Conclusion

    Ollama commands at a glance

    How we compare: commands and defaults on this page are checked against Ollama’s official CLI reference and FAQ. Ollama changes quickly, so run ollama help <command> to confirm the options on your installed version.

    CommandWhat it doesExample
    ollama runChat with a model, or answer one prompt and exitollama run gemma4
    ollama pullDownload or update a modelollama pull qwen3
    ollama ls / ollama listList installed models and their sizesollama ls
    ollama psShow loaded models and CPU/GPU splitollama ps
    ollama stopUnload a running model from memoryollama stop gemma4
    ollama rmDelete a model from diskollama rm qwen3
    ollama showShow a model’s details, parameters and licenceollama show gemma4
    ollama cpCopy a model under a new nameollama cp gemma4 my-gemma
    ollama createBuild a custom model from a Modelfileollama create mybot -f Modelfile
    ollama serveStart the Ollama server manuallyollama serve
    ollama launchSet up a coding app to use Ollama modelsollama launch
    ollama signinSign in to an Ollama accountollama signin
    Laptop screen with a code editor open, where developers script local models

    Running models and the most useful flags

    Run ollama run <model> for an interactive chat, or add a prompt in quotes to get one answer and return to the shell, which is handy in scripts. You can pipe text in as well: cat notes.txt | ollama run gemma4 "Summarize this". For multimodal models, include an image path in the prompt. For multiple lines in the chat, wrap your text in triple quotes.

    FlagEffect
    --verbosePrints timing stats, including tokens per second, after each reply
    --format jsonForces the reply to be valid JSON
    --think / --hidethinkingTurns thinking on for reasoning models, or uses it but hides the trace
    --keepalive 10mKeeps the model in memory for a set time after the last request
    --nowordwrapTurns off word wrapping in the output

    Slash commands inside a chat

    While chatting, /set parameter num_ctx 8192 raises the context window for the session, /set system "..." changes the system prompt, /show parameters or /show info displays settings, /save mymodel saves the session as a new local model and /bye exits. Type /? for the full list.

    Inspecting a model with ollama show

    ollama show <model> prints the architecture, parameter count, context length and quantization. Add --modelfile, --parameters, --system, --template or --license to print just that part. Check the licence before using a model commercially.

    Managing memory with ollama ps and ollama stop

    By default Ollama keeps a model in memory for five minutes after its last request, then unloads it. ollama ps shows what is loaded, and its PROCESSOR column tells you where: 100% GPU means the whole model is on the graphics card, 100% CPU means it is running from system memory, and a split such as 48%/52% CPU/GPU means it did not fully fit, which is the most common reason for slow replies. Use ollama stop to free memory immediately, or choose a smaller or more heavily quantized model. Our hardware guide explains how much memory each model size needs.

    Developer typing on a laptop while a local language model runs in the background

    Server settings and environment variables

    The Ollama server listens on 127.0.0.1:11434 by default, so only your own computer can reach it. Settings are changed with environment variables set before the server starts: on Windows and macOS, set them and restart the app; on Linux, add them to the systemd service with sudo systemctl edit ollama and restart it.

    VariableWhat it controlsDefault
    OLLAMA_HOSTAddress and port the server binds to127.0.0.1:11434
    OLLAMA_MODELSFolder where models are storedYour user folder under .ollama/models (Linux: /usr/share/ollama/.ollama/models)
    OLLAMA_CONTEXT_LENGTHDefault context window for all models4,096 tokens
    OLLAMA_KEEP_ALIVEHow long models stay loaded after use5 minutes
    OLLAMA_NUM_PARALLELParallel requests each model handles1
    OLLAMA_MAX_LOADED_MODELSModels loaded at once, if they fit3 per GPU

    Raising the context length lets the model read longer documents but uses more memory, and the memory needed grows with the number of parallel requests too. Setting OLLAMA_HOST=0.0.0.0 exposes Ollama to your network; only do that on a trusted network, because the API has no password by default.

    Custom models with a Modelfile

    A Modelfile is a short text file that builds a customized model from an existing one. FROM names the base model, PARAMETER sets options such as num_ctx or temperature, and SYSTEM sets a permanent system prompt. Save it, run ollama create mybot -f Modelfile, then ollama run mybot. It is the easiest way to make a model that always answers in your team’s format with a longer context window.

    Calling Ollama from code

    Everything the command line does is also available through the local REST API at http://localhost:11434. Send chat requests to /api/chat, one-off prompts to /api/generate, and list models with /api/tags. Ollama also offers an OpenAI-compatible endpoint at /v1/chat/completions, so many apps and SDKs built for OpenAI can point at your local models by changing the base URL. That makes it easy to test a local model before paying for a hosted one; our best AI API guide compares the hosted options.

    Fixing common Ollama problems

    Slow replies: run ollama ps; if the model is split between CPU and GPU, use a smaller model or a lower-bit quantization. Out of memory or crashes: lower num_ctx or stop other loaded models. Port already in use: Ollama is probably already running in the background, so use it rather than starting a second ollama serve. Something else: check the server log. On Linux, run journalctl -u ollama; on macOS, the log is in ~/.ollama/logs/server.log; on Windows, look in %LOCALAPPDATA%\Ollama.

    Hands typing on a laptop keyboard, automating a daily summary with a local model

    How one analyst scripted a daily summary

    Illustrative example. Dario Esposito is a market analyst in Naples who reads dozens of supplier updates each morning. He installed Ollama, pulled a mid-sized model and checked with ollama ps that it ran 100% on his graphics card.

    He wrote a Modelfile with a system prompt for his preferred summary format and a larger context window, created a custom model from it, and set up a scheduled script that pipes each day’s updates into ollama run. The summaries are ready when he starts work, and nothing leaves his laptop. For the bigger picture, see our local AI guide and our comparison of Ollama vs LM Studio.

    Frequently Asked Questions

    What are the basic Ollama commands?

    The core Ollama commands are ollama run to chat with a model, ollama pull to download one, ollama ls to list installed models, ollama ps to see what is loaded, ollama stop to unload a model, ollama rm to delete one, ollama show for details and ollama serve to start the server.

    What does ollama ps show?

    It lists the models currently loaded in memory, their size, how long they will stay loaded and the PROCESSOR column. 100% GPU means the model fits entirely on the graphics card; a CPU/GPU split means part of it is in system memory, which slows replies.

    How do I stop or unload a model in Ollama?

    Run ollama stop followed by the model name to unload it from memory immediately. Otherwise Ollama unloads a model five minutes after its last request by default, which you can change with OLLAMA_KEEP_ALIVE or the –keepalive flag.

    Where does Ollama store models?

    On macOS and Windows, models are stored in the .ollama/models folder inside your user directory. On Linux the default is /usr/share/ollama/.ollama/models. Set the OLLAMA_MODELS environment variable to use a different folder, such as a larger drive.

    How do I increase the context length in Ollama?

    Inside a chat, use /set parameter num_ctx followed by the size. For every model, set OLLAMA_CONTEXT_LENGTH before starting the server, or add PARAMETER num_ctx to a Modelfile. The default is 4,096 tokens, and larger contexts need more memory.

    Is there a GUI for Ollama?

    Yes. Recent versions of Ollama include a desktop app on Windows and macOS for chatting with models, and many third-party interfaces connect to its local API. If you prefer a full graphical model browser, LM Studio is the main alternative.

    Conclusion

    A dozen Ollama commands cover almost everything: run, pull, ls, ps, stop, rm, show, create and serve, plus a few flags and environment variables. Learn ollama ps first, because it tells you whether a model actually fits on your GPU.

    When the command line is not enough, the same features are available through the local API. Keep this cheat sheet open and check ollama help whenever you update.

    local AI local LLM
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleBest Local AI Video Editors: Edit With AI on Your Own Computer
    Hamza
    • Website

    Hamza is a software engineer working professionally since 2022, and the writer and editor behind TechieHub. He covers AI tools and models: which ones are worth paying for, what they actually cost, and what runs locally on consumer hardware. Prices, plan limits, licences and hardware figures are checked against each vendor's own page and dated in the article, and anything that could only be found on third-party trackers is labelled as reported. TechieHub does not run lab benchmarks and says so where it matters. Based in Pakistan. Reach him at contact@techiehub.blog.

    Related Posts

    Best Local AI Video Editors: Edit With AI on Your Own Computer

    October 22, 2026

    Best Hardware for Local LLMs in 2026: GPUs, Macs and AI Mini PCs Compared

    October 22, 2026

    How to Generate AI Videos Locally: A Step-by-Step ComfyUI Guide

    October 21, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Ollama Commands: The Complete Cheat Sheet With Examples

    October 23, 2026

    Best Local AI Video Editors: Edit With AI on Your Own Computer

    October 22, 2026

    Best Hardware for Local LLMs in 2026: GPUs, Macs and AI Mini PCs Compared

    October 22, 2026

    How to Generate AI Videos Locally: A Step-by-Step ComfyUI Guide

    October 21, 2026
    Techiehub
    • Home
    • Featured
    • Latest Posts
    • Latest in Tech
    • Terms and Conditions
    • Editorial Policy
    • Privacy Policy
    • Disclaimer
    • About Us
    • Contact Us
    Copyright © 2026 Tchiehub. All Right Reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.