# eg

> Command-line tool that provides practical usage examples for common CLI utilities like find, tar, and grep.

Stars: 2.0k · Categories: Productivity

- Repository: https://github.com/srsudar/eg
- Page: https://www.trmn.sh/tools/eg

## Install

- pip: `pip install eg`
- Homebrew: `brew install eg-examples`

## Overview

`eg` is a command-line reference tool that displays practical usage examples for common CLI utilities. It serves as a complement to man pages by providing real-world examples instead of comprehensive documentation. While man pages list all flags and options, `eg` focuses on showing how to actually use tools like `find`, `tar`, `grep`, and others in common scenarios.

The tool maintains a collection of examples in markdown format, stored in files named after each command (e.g., `find.md` for find examples). When you run `eg find`, it displays the contents of the corresponding example file through a pager. Examples are formatted to clearly distinguish between user input (indented four spaces or surrounded by backticks) and command output.

`eg` supports extensive customization through configuration files. Users can create custom example directories, modify color schemes, configure regex-based output transformations, and adjust paging behavior. The tool respects the `PAGER` environment variable and allows custom pager commands. It also includes features like output squeezing to remove excess blank lines and supports both default and user-defined example collections.

The tool targets developers, system administrators, and anyone who frequently uses command-line utilities but occasionally forgets specific syntax or common usage patterns. It's particularly useful for complex tools like `tar` that are notoriously difficult to remember without consulting examples.

### Installation

```bash
# via pip
pip install eg
```

```bash
# via Homebrew
brew install eg-examples
```

![eg demo showing find command examples](https://media.trmn.sh/cached/285fcc0fb423e46436abe40e0354a862d93b2e8052fbf9850114f4d9a1b4d116.gif)

![Squeezed output format](https://media.trmn.sh/cached/fdd3b31815e186351d7eeade7a4c6f3de354de2092ded3f6ca96018200648773.png)

## Alternatives

- [circumflex](https://www.trmn.sh/tools/circumflex.md): Terminal-based Hacker News browser with vim-style navigation and built-in article reader (Go, 2.1k stars)
- [taskwarrior-tui](https://www.trmn.sh/tools/taskwarrior-tui.md): A terminal user interface for Taskwarrior with vim-like navigation and live filtering capabilities. (Rust, 2.2k stars)
- [kalker](https://www.trmn.sh/tools/kalker.md): Scientific calculator CLI with support for calculus, variables, functions, matrices, and multiple number bases (Rust, 1.9k stars)
- [termusic](https://www.trmn.sh/tools/termusic.md): Terminal music and podcast player in Rust with a server/TUI split, rusty, MPV and GStreamer backends, tag editor, and YouTube downloads via yt-dlp. (Rust, 2.2k stars)
- [calcure](https://www.trmn.sh/tools/calcure.md): TUI calendar and task manager with vim keys, cloud sync, and customizable interface (2.4k stars)

## Guides

- [Modern Replacements for man](https://www.trmn.sh/replace/man): Replace man with tldr, tealdeer or eg: example-first command help instead of full manuals. Compare clients, offline use and customization.
- [tldr Alternatives](https://www.trmn.sh/alternatives/tldr): tldr alternatives: cheat for editable cheatsheets, navi for runnable fuzzy-searched snippets, eg for paged example files.

---

Canonical: https://www.trmn.sh/tools/eg
