Skip to main content

cmdo

A mini Google for your terminal. Ask what a command does, describe a task and get the command for it, or check what is installed on your machine — all offline.

No API keys. No network calls. No dependencies beyond the python3 already on your system.

$ cmdo how "join two commands"

  how to: join two commands

  1. |   strong match
     The pipe. Sends the output of one command straight into the input of the next.
     Use it when you want to filter, sort, count or transform whatever another
     command prints.
       cat file.txt | grep error
       ps aux | grep node | wc -l

Install

pip install cmdo-terminal

The package is cmdo-terminal because cmdo was already taken on PyPI. The command you type is still cmdo.

Or, to keep it isolated from your other Python packages:

pipx install cmdo-terminal

Straight from source, without waiting for a release:

pip install git+https://github.com/LuShadowX/cmdo.git

There is nothing to configure — the command database ships inside the package. To uninstall: pip uninstall cmdo-terminal.

The three things it does

1. Explain a command

$ cmdo grep

  grep  · text
  Search text for lines that match a pattern, and print them.

  Give it a pattern and some input - a file, several files, or a pipe - and it
  prints every line that matches. The pattern is a regular expression, so it
  handles far more than plain words. The flags you will use constantly are -i to
  ignore case, -r to search a whole directory recursively, -n to show line
  numbers, and -v to invert the match and show lines that do not contain the
  pattern.

  EXAMPLES
    grep -rn 'TODO' src/
      find every TODO in a directory, with file and line numbers
    cat app.log | grep -i error
      keep only the error lines, ignoring case

  When to reach for it: you know roughly what the text says but not which file
  or line it is on.

  SEE ALSO  rg · sed · awk · find
  ON THIS SYSTEM  /usr/bin/grep

Operators count as commands, so cmdo '|', cmdo '&&' and cmdo '2>&1' all work. So do multi-word git entries: cmdo git rebase.

2. Search by what you want to do

$ cmdo how "find text in files"

Describe the task in plain words. It ranks the database by weighted keyword scoring and shows the top three, each with why it fits and a concrete example. If nothing scores well enough it says so rather than guessing.

3. Check your machine

$ cmdo have docker

  yes  docker is installed
    path     /opt/homebrew/bin/docker
    real     /opt/homebrew/Cellar/docker/28.4.0/bin/docker
    version  Docker version 28.4.0, build d8eb465f86
    what     Build and run applications in containers.

Exit code is 0 when found and 1 when not, so it works in scripts:

cmdo have jq >/dev/null || brew install jq

And to see what you already have:

$ cmdo search net

  17 installed commands matching net

  netstat                  Show network connections, listening ports and...
  nettop                   Display updated information about the network...
  networksetup             configuration tool for network settings in...

Typos and unknown commands

Misspell something and it suggests the closest real match:

$ cmdo gerp

  Unknown command: gerp

  Did you mean grep or zgrep or gperf?
  Run: cmdo grep

If a command is installed but not in the database, cmdo reads your own man page for it, so coverage is not limited to what ships in the JSON.

What is in the database

177 hand-written entries — not scraped man pages:

Area Covers
Operators | && || > >> 2>&1 & $( ) * ~ !! $? and more
Files ls, cd, cp, mv, rm, find, chmod, chown, du, df, ln, stat
Text grep, sed, awk, cut, sort, uniq, wc, tr, tee, diff, xargs, jq
Networking curl, wget, ssh, scp, rsync, dig, ping, lsof, netstat, nc, openssl
Processes ps, top, kill, pkill, pgrep, jobs, nohup, watch, timeout
Git 26 entries — status, add, commit, push, pull, rebase, stash, reset, blame
System uname, env, export, alias, sudo, crontab, history, date
Archives tar, zip, unzip, gzip, zcat
Packages brew, apt, npm, npx, pip3

Options

cmdo <command>           Explain a command in plain English
cmdo how "<task>"        Find the right command for what you want to do
cmdo have <command>      Check if a command is installed, and where
cmdo search <keyword>    List installed commands matching a keyword

-h, --help       Show help
-v, --version    Show version
    --no-color   Disable colored output

Colour turns itself off when output is piped, and honours NO_COLOR.

How it works

One Python module, one JSON file. cmdo is stdlib-only — json, difflib, shutil, subprocess, textwrap. It has zero package dependencies, so pip install cmdo-terminal downloads nothing but cmdo itself.

how scores every entry against your query: an exact keyword phrase is worth 10 points, a token inside a keyword 4, a token in the summary 3, in the detail 1, and a difflib close match 3 for typos. The total is scaled by how much of your query was matched, so a short precise hit beats a long noisy one. Anything under a floor score is reported as "no confident match" instead of a wrong answer.

Adding a command means adding an object to src/cmdo/data/commands.json — name, category, summary, detail, examples, keywords. No code changes.

src/cmdo/
├── cli.py               everything: parsing, scoring, rendering, system probing
├── __main__.py          so `python3 -m cmdo` works too
└── data/commands.json   the knowledge base

Requirements

  • macOS or Linux
  • Python 3.8 or newer (preinstalled on macOS and every mainstream Linux distribution)

Licence

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmdo_terminal-1.0.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmdo_terminal-1.0.0-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file cmdo_terminal-1.0.0.tar.gz.

File metadata

  • Download URL: cmdo_terminal-1.0.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for cmdo_terminal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b5d89a0e5c95f4d640085ec6e00d3220f240bc0103d7546dc0acb4df37585b6
MD5 8049d51d0d88de5f31770d7debf38c9c
BLAKE2b-256 c0c4b20ee0f569e79e2ced87dddac101892cc1f76d2587114d04c4caaf1bc1da

See more details on using hashes here.

File details

Details for the file cmdo_terminal-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cmdo_terminal-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for cmdo_terminal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a402d23ff6f3d184544df42eb6984a650910e718fd416f5b2e7dc6c58a2b151
MD5 e356ec8693270b8572946cb3ff3f893e
BLAKE2b-256 a18d93ff19d05b20fffc831e92fee554deb44411df1d88bd38625729d95d7337

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page