<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw" -->

---
title: I added an AI command to my terminal that explains...
description: A shell function pipes Linux log output into a local LLM running via Ollama to explain cryptic errors without sending data to a third party. The `explain`...
canonical: https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I added an AI command to my terminal that explains cryptic logs without leaking my data | daily.dev
og:description: A shell function pipes Linux log output into a local LLM running via Ollama to explain cryptic errors without sending data to a third party. The `explain`...
og:url: https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw
og:image: https://api.daily.dev/og/posts/PMmeJv7uW.png
og:image:alt: I added an AI command to my terminal that explains cryptic logs without leaking my data
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I added an AI command to my terminal that explains cryptic logs without leaking my data

**[XDA Developers](https://daily.dev/sources/xda-developers)** · 3 min read · 3 upvotes · 0 comments

## Summary

A shell function pipes Linux log output into a local LLM running via Ollama to explain cryptic errors without sending data to a third party. The `explain` function uses `tail -n 100` to limit input size and `jq -n --arg` to safely escape special characters before sending the prompt to the qwen3:14b model with streaming and thinking disabled. A system prompt instructs the model to state the likely cause, cite the lines it used, and admit uncertainty rather than hallucinate. Adding context like the OS, ZFS pool, Plex, and Docker setup improves the relevance of suggestions, though the 14B local model sometimes proposes incorrect fixes compared to cloud AI.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.xda-developers.com/terminal-ai-command-explains-log-file-errors>

## Questions this post answers

### How can I use a local LLM to explain confusing Linux log errors without sending data to the cloud?

Pipe log output into a local model running on Ollama using a shell function. One approach uses `tail -n 100` to limit input size, `jq -n --arg` to safely escape special characters, and sends the prompt to a model like qwen3:14b via `curl` to `localhost:11434/api/generate` with `stream:false` and `think:false` for faster single responses.

_daily.dev surfaces local-first AI workflows for developers who want log analysis without sending data off-machine._

### Why would I disable the think setting when calling an Ollama model's API?

Turning off the `think` parameter makes the model reply faster by skipping its reasoning step before returning an answer. This is useful for quick, single-shot tasks like explaining a log error where speed matters more than deep step-by-step reasoning.

_developers tuning local LLM response speed can track practical Ollama configuration tips on daily.dev._

### How do I stop a shell script from breaking when piping text with special characters into a JSON API request?

Use `jq -n --arg` to build the JSON payload instead of manually constructing a JSON string. This safely handles quotes, newlines, and backslashes in arbitrary text like log output, preventing malformed JSON errors when sending the data to an API endpoint such as Ollama's `/api/generate`.

_shell scripters wiring text into APIs can find more jq and bash patterns on daily.dev._

## Similar posts on daily.dev

- [I gave my 9-year-old laptop server a local LLM job every night, and it reads my homelab logs so I don’t have to](https://daily.dev/posts/i-gave-my-9-year-old-laptop-server-a-local-llm-job-every-night-and-it-reads-my-homelab-logs-so-i-do-peeaqayae) · XDA Developers · 52 upvotes · 4 comments
- [10 ways to use AI for Linux troubleshooting and productivity](https://daily.dev/posts/10-ways-to-use-ai-for-linux-troubleshooting-and-productivity-acg6r5902) · All Things Open · 0 upvotes · 0 comments
- [With a sandbox workspace of its own, Olly answers bigger questions](https://daily.dev/posts/with-a-sandbox-workspace-of-its-own-olly-answers-bigger-questions-by1bf5qk5) · Coralogix · 0 upvotes · 0 comments
- [ollama 0.14 Can Make Use Of Bash For Letting AI/LLMs Run Commands On Your System](https://daily.dev/posts/ollama-0-14-can-make-use-of-bash-for-letting-ai-llms-run-commands-on-your-system-b5gnbsldc) · Phoronix · 1 upvotes · 0 comments
- [Explain Method](https://daily.dev/posts/explain-method-5mndexlos) · Larablog · 1 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#privacy](https://daily.dev/tags/privacy), [#local-ai](https://daily.dev/tags/local-ai), [#bash](https://daily.dev/tags/bash), [#ollama](https://daily.dev/tags/ollama)

[View this post on daily.dev](https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I added an AI command to my terminal that explains cryptic logs without leaking my data","url":"https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw"},"datePublished":"2026-11-24T19:32:07.165Z","dateModified":"2026-11-24T19:35:19.237Z","description":"A shell function pipes Linux log output into a local LLM running via Ollama to explain cryptic errors without sending data to a third party. The `explain`...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c00ee86e148dc52586c34291b8811904?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c00ee86e148dc52586c34291b8811904?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"XDA Developers","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"XDA Developers","logo":"https://media.daily.dev/image/upload/s--kCg6yyAP--/f_auto,q_auto/v1774964407/logos/xda-developers?_a=BAMAMiWQ0","url":"https://daily.dev/sources/xda-developers"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux,privacy,local-ai,bash,ollama","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"XDA Developers","item":"https://daily.dev/sources/xda-developers"},{"@type":"ListItem","position":3,"name":"I added an AI command to my terminal that explains cryptic logs without leaking my data"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-added-an-ai-command-to-my-terminal-that-explains-cryptic-logs-without-leaking-my-data-pmmejv7uw#faq","mainEntity":[{"@type":"Question","name":"How can I use a local LLM to explain confusing Linux log errors without sending data to the cloud?","acceptedAnswer":{"@type":"Answer","text":"Pipe log output into a local model running on Ollama using a shell function. One approach uses `tail -n 100` to limit input size, `jq -n --arg` to safely escape special characters, and sends the prompt to a model like qwen3:14b via `curl` to `localhost:11434/api/generate` with `stream:false` and `think:false` for faster single responses. daily.dev surfaces local-first AI workflows for developers who want log analysis without sending data off-machine."}},{"@type":"Question","name":"Why would I disable the think setting when calling an Ollama model's API?","acceptedAnswer":{"@type":"Answer","text":"Turning off the `think` parameter makes the model reply faster by skipping its reasoning step before returning an answer. This is useful for quick, single-shot tasks like explaining a log error where speed matters more than deep step-by-step reasoning. developers tuning local LLM response speed can track practical Ollama configuration tips on daily.dev."}},{"@type":"Question","name":"How do I stop a shell script from breaking when piping text with special characters into a JSON API request?","acceptedAnswer":{"@type":"Answer","text":"Use `jq -n --arg` to build the JSON payload instead of manually constructing a JSON string. This safely handles quotes, newlines, and backslashes in arbitrary text like log output, preventing malformed JSON errors when sending the data to an API endpoint such as Ollama's `/api/generate`. shell scripters wiring text into APIs can find more jq and bash patterns on daily.dev."}}]}
```

