Bashnet is a cross-platform command-line tool that helps you explore and learn Bash commands, options, and scripting structures using a semantic network.
- Import modular Bash knowledge from structured JSON files
- Deep semantic search: finds related options, concepts, commands
- Simple search: retrieve a single concept by label
- Export complete semantic network as
knowledge_net.json - Visualize the network as interactive HTML (via pyvis)
- Fully Docker-compatible for platform-independent execution
- CLI interface with live terminal usage
Each file defines a component of the semantic network:
commands.json: Bash commands (e.g.ls,cd)options.json: CLI flags and options (e.g.-l,--help) — must be described independently of any commandscripting.json: Syntax and structures likeif,for,[[ ]]concepts.json: Abstract/contextual terms likedirectory,stdoutknowledge_net.json: The complete, generated semantic network (nodes + relations)
All files should be placed in the src/data/ folder to be imported correctly.
To get started, here's a small valid example:
src/data/commands.json
[
{
"id": "cmd_cd",
"label": "cd",
"type": "command",
"description": "Changes the current working directory to a specified path.",
"category": "file management",
"tags": [
"filesystem",
"navigation",
"directory",
"shell"
],
"examples": [
{
"command": "cd /home/user",
"expected_output": "",
"explanation": "Changes to the absolute path '/home/user'."
},
{
"command": "cd ..",
"expected_output": "",
"explanation": "Moves one level up to the parent directory."
}
],
"options": [],
"related": [
"cmd_pwd",
"con_directory"
],
"links": [
"https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html#index-cd"
]
}
]
Make sure docker is installed.
docker build -t bashnet .docker run --rm -it \
-v "$PWD:/app" \
-e RUNNING_IN_DOCKER=1 \
bashnetdocker build -t bashnet .docker run --rm -it `
-v "${PWD}:/app" `
-e RUNNING_IN_DOCKER=1 `
bashnet| Flag | Description |
|---|---|
--rm |
Automatically delete the container after exit |
-it |
Enables interactive input/output (CLI) |
-v "$PWD:/app" |
Mounts your working dir (so JSON & HTML stay persistent) |
-e RUNNING_IN_DOCKER=1 |
Disables automatic browser open for HTML inside container |
Run inside the container or Python shell:
bashnet> import
→ Loads JSON files and builds the semantic net
bashnet> search <term>
→ Deep search including context like options, related concepts
bashnet> search <term> --simple
→ Exact search for a node only
bashnet> visualize
→ Generates semantic_net.html with interactive graph
bashnet> exit
→ Leave the Bashnet CLI
You can also run Bashnet locally if you prefer:
- Ensure Python 3.12+ is installed
- Install dependencies:
pip install -r requirements.txt- Run the CLI:
python -m bashnetMinimal:
click
networkx
pyvis
Optionally, use Poetry for development:
poetry install
poetry run python -m bashnetMIT License – free to use, modify, extend. Copyright (c) 2025