name: local-docs description: Answer Linux administration and debugging questions using local machine documentation first. Use when the user asks about Linux commands, config files, system calls, kernel parameters, daemons, packages, or any sysadmin/debugging topic and wants to consult man pages, info pages, /usr/share/doc, package examples, or header files under /usr/include. Also handles finding installable documentation packages via apt-cache search, apt-file search, dnf repoquery, or yum provides when local docs are incomplete. Prefer this over web search for any Linux-specific documentation lookup.
Local Docs
Overview
Answer Linux administration and debugging questions by consulting the local machine's documentation first. Search installed man pages, info pages, /usr/share/doc, package examples, and header files before touching the network. If local docs are incomplete, search distro package metadata for installable documentation and ask before recommending any install. Always show exact file paths and verbatim command/config snippets.
Run Workflow
Detect the distro and package manager:
cat /etc/os-releaseMap
IDorID_LIKEto the package manager:apt(Debian/Ubuntu),dnf/yum(RHEL/Fedora/CentOS),pacman(Arch),zypper(SUSE).Search installed man pages:
man -k <keyword> # full-text keyword search across all installed man pages man <topic> # default section man 5 <topic> # section 5 = config files man 8 <topic> # section 8 = admin commands manpath # show where man pages are storedPrefer
man 5for config file questions,man 8for daemon/admin commands,man 1for user commands.Search info pages:
info <topic> ls /usr/share/info/ | grep -i <topic>Info pages often contain more detail than man pages for GNU tools (coreutils, bash, make, etc.).
Search
/usr/share/doc/:ls /usr/share/doc/ | grep -i <pkg> ls /usr/share/doc/<pkg>/Look for:
README,README.Debian,examples/,*.conf.example,changelog.gz,NEWS.gz. Read examples verbatim and cite their path.Search header files (for system calls, library APIs, kernel interfaces):
grep -r "<symbol>" /usr/include/ -l # find relevant headers grep -n "<symbol>" /usr/include/<path>.h # show definition with line numbersEvaluate completeness. If the installed docs fully answer the question, stop here. Report the answer with exact file paths cited for every snippet.
Search distro metadata for installable docs (only if local docs are incomplete):
Debian/Ubuntu:
# Check if apt-file is available first command -v apt-file && apt-file search <topic> || echo "apt-file not installed" apt-cache search <pkg>-doc apt-cache show <pkg>-doc 2>/dev/null | grep -E "^(Package|Description)"RHEL/Fedora/CentOS:
dnf search doc <pkg> dnf repoquery --provides <pkg> yum provides <file-or-symbol> # fallback if dnf unavailableArch Linux:
pacman -Ss <pkg>Label every result clearly:
- Prefix installed sources with
[Installed] - Prefix uninstalled packages with
[Available — not installed]
- Prefix installed sources with
Suggest the smallest relevant doc package if one is found uninstalled. Do NOT suggest installing it — ask first:
The package
<pkg>-doccontains the missing documentation. Should I show you the install command?Report with verbatim snippets, exact file paths, and the precise commands run.
Graceful Degradation
| Missing tool | Behavior |
|---|---|
apt-file not installed |
Note it; show: sudo apt-get install apt-file && sudo apt-file update; fall back to apt-cache search |
dnf/yum not found |
Skip RHEL step; note distro mismatch |
/usr/share/doc/<pkg>/ empty |
Say so; suggest <pkg>-doc package via package manager |
man -k returns nothing |
Suggest sudo mandb to rebuild the man page index |
| Distro unknown | Try both apt-cache search and dnf search; note which one worked |
Source Priority
man/infopages — fastest, always try first/usr/share/doc/— READMEs, examples, changelogs/usr/include/— headers for system call / API questions- Distro package metadata —
apt-file,apt-cache,dnf repoquery - Internet — only if user explicitly requests it
Guardrails
- Never run
apt-get install,dnf install, or equivalent without explicit user confirmation. - Always cite the exact file path for every snippet:
# from /usr/share/doc/nginx/examples/nginx.conf - Prefer the most targeted doc package:
nginx-docover reinstallingnginx. - When using
man -k, limit noise: pipe throughgrep -i <keyword>if results are excessive. - For config file questions, always show the relevant
man 5section and the actual default config path.
Load Detailed Reference On Demand
Read references/sources.md when you need:
- Man page section number cheat-sheet
/usr/share/doc/common file layoutsapt-fileanddnf repoqueryflag reference- How to reverse-map a binary to its doc package with
dpkg -Sorrpm -qf