https://github.com/zhanxw/histoterm
Draw histogram in terminal
https://github.com/zhanxw/histoterm
Last synced: 4 months ago
JSON representation
Draw histogram in terminal
- Host: GitHub
- URL: https://github.com/zhanxw/histoterm
- Owner: zhanxw
- License: gpl-3.0
- Created: 2025-11-13T16:15:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-11-13T17:03:45.000Z (7 months ago)
- Last Synced: 2025-11-13T18:16:43.198Z (7 months ago)
- Language: Rust
- Size: 2.13 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# histoterm



A lightweight Rust CLI tool that reads numeric data from **stdin** and prints an **ASCII histogram** showing the data distribution — perfect for quick data exploration right from the terminal.
---
## 🧩 Installation
### Option 1 — From local source
```bash
cargo install --path .
```
This installs `histoterm` into Cargo’s bin directory (usually `~/.cargo/bin`).
---
### Option 2 — Directly from GitHub
Install the latest version straight from the repository:
```bash
cargo install --git https://github.com/zhanxw/histoterm
```
Or specify a branch, tag, or commit:
```bash
cargo install --git https://github.com/zhanxw/histoterm --branch main
```
---
## 🛠️ Build from source
If you just want to build without installing:
```bash
cargo build --release
```
The compiled binary will be at:
```
target/release/histoterm
```
---
## 🖼️ Preview
Here’s what `histoterm` looks like in action:
```text
$ seq 100 | awk 'BEGIN{srand()} {for(i=0;i` | Number of histogram bins | `10` |
| `--width ` | Maximum bar width (characters) | `50` |
---
## 🧮 Usage examples and piping
You can pipe **any stream of numbers** into `histoterm`.
Here are some practical examples:
### 1️⃣ From a CSV column
Use `awk`, `cut`, or `csvkit` to extract numeric data:
```bash
cut -d, -f3 data.csv | tail -n +2 | histoterm --bins 20
```
For tab-separated files:
```bash
awk -F'\t' '{print $5}' data.tsv | histoterm
```
---
### 2️⃣ From logs or JSON data
Extract numeric values from logs:
```bash
grep "latency=" server.log | sed 's/.*latency=//' | histoterm
```
From JSON data:
```bash
jq '.response_time' data.json | histoterm --bins 15
```
---
### 3️⃣ Combine with other tools
Chain with statistical or simulation outputs:
```bash
python -c "import numpy as np; [print(x) for x in np.random.normal(0,1,1000)]" | histoterm --bins 20 --width 70
```
---
## 📄 License
GPLv3 License © 2025
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .