← Course overview

Open Weight Models · linux · Keep nearby

Ollama quick reference · linux

Use these commands from a Linux client shell. Keep the same server mode throughout the course. Commands marked systemd require an installed ollama.service on a machine running systemd; ollama serve is the alternative foreground workflow, not an extra server to start alongside it.

Everyday commands

CommandUse it to…
cd "$HOME/CyberCorps/open-weight-models"Return to the folder containing your Python files, Modelfile, and evidence.
python3 --versionCheck the Python 3 interpreter used by the API and capstone scripts.
ollama --versionInspect the installed Ollama client version.
ollama listCheck the server connection and its downloaded model inventory.
ollama pull gemma3:1bDownload the local course model.
ollama run gemma3:1bOpen a local model chat; enter /bye inside the chat to return to the shell.
ollama show gemma3:1bInspect the selected model's details.
ollama psInspect loaded models and their observed processor allocation.
ollama stop gemma3:1bUnload the base model while keeping its downloaded files.
ollama create cybercorps-study -f ModelfileCreate or update the named assistant from the file in your current project folder.
ollama show --modelfile cybercorps-studyInspect the configuration stored under the capstone's model name.
python3 local_chat.pyRun the saved lesson 5 client from the project folder.
python3 study_assistant.pyRun the five capstone cases using cybercorps-study.
free -hInspect system memory where procps/procps-ng free is installed; this does not report all GPU memory.
systemctl status ollama --no-pagerSystemd only: inspect the installed Ollama service before deciding whether to start it.
sudo systemctl start ollamaSystemd only: start the installed service if it is inactive.
sudo journalctl -u ollama -b -n 100 --no-pagerSystemd only: read recent Ollama logs from the current boot.
sudo systemctl edit ollamaSystemd only: edit the service override; lesson 7 shows the local-only Environment setting and restart steps.
OLLAMA_NO_CLOUD=1 ollama serveManual foreground alternative: start only after stopping your own prior foreground server and confirming no competing service; verify its startup output.

Run one command at a time. Model removal changes your local installation; unloading a model only releases its memory. See Lesson 7 for troubleshooting and privacy settings.

Make a local API request

Start Ollama and download gemma3:1b first. These examples request one complete JSON response. The answer is in message.content. Use the example for your shell.

Linux shell: send a local chat request · bash

curl --fail --show-error --max-time 120 \
  http://localhost:11434/api/chat \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemma3:1b",
    "stream": false,
    "messages": [
      {"role": "user", "content": "Note: the workshop starts at 09:30. Using only this note, what time does it start?"}
    ]
  }'

The local endpoint needs no API key. Keep it on your own machine; it is not an authenticated public service. See Lesson 5 for a Python client and conversation history.

Key terms

Weights

The learned numerical parameters used by a model. Their availability does not by itself describe the permissions in its licence.

Inference

Using an existing model to generate a result from an input.

Token

A unit of text processed by the model. A word may occupy more than one token.

Context

The working input available for a generation, including instructions, supplied material, and conversation history.

Quantisation

Representing model values with fewer bits to reduce storage and memory needs, with possible quality trade-offs.

Model tag

A model identifier such as gemma3:1b. Record the model ID as well when you need to track a particular downloaded version.

Modelfile

An Ollama configuration that selects a base model and supplies settings or instructions.

Evaluation

Checking outputs against defined tasks and expected behaviour, while recording errors as well as successes.

Official references