explainshell is a tool (with a web interface) capable of parsing man pages, extracting options and explaining a given command-line by matching each argument to the relevant help text in the man page.
explainshell is built from the following components:
When querying explainshell, it:
Right now explainshell.com contains the entire archive of Ubuntu. It's not possible to directly add a missing man page to the live site (it might be in the future).
Setup a working environment that lets you run the web interface locally using docker:
# download db dump
$ curl -L -o /tmp/dump.gz https://github.com/idank/explainshell/releases/download/db-dump/dump.gz
# Clone Repository
$ git clone https://github.com/idank/explainshell.git
# start containers, load man pages from dump
$ docker-compose build
$ docker-compose up
$ docker-compose exec -T db mongorestore --archive --gzip < /tmp/dump.gz
# run tests
$ docker-compose exec -T web make tests
..SSSSSSSSS.....................................................................
----------------------------------------------------------------------
Ran 80 tests in 0.041s
OK (SKIP=9)
# open http://localhost:5000 to view the ui
Use the manager to parse and save a gzipped man page in raw format:
$ docker-compose exec -T web bash -c "PYTHONPATH=. python explainshell/manager.py --log info /usr/share/man/man1/echo.1.gz"
INFO:explainshell.store:creating store, db = 'explainshell_tests', host = 'mongodb://localhost'
INFO:explainshell.algo.classifier:train on 994 instances
INFO:explainshell.manager:handling manpage echo (from /tmp/es/manpages/1/echo.1.gz)
INFO:explainshell.store:looking up manpage in mapping with src 'echo'
INFO:explainshell.manpage:executing '/tmp/es/tools/w3mman2html.cgi local=%2Ftmp%2Fes%2Fmanpages%2F1%2Fecho.1.gz'
INFO:explainshell.algo.classifier:classified <paragraph 3, DESCRIPTION: '-n do not output the trailing newlin'> (0.991381) as an option paragraph
INFO:explainshell.algo.classifier:classified <paragraph 4, DESCRIPTION: '-e enable interpretation of backslash escape'> (0.996904) as an option paragraph
INFO:explainshell.algo.classifier:classified <paragraph 5, DESCRIPTION: '-E disable interpretation of backslash escapes (default'> (0.998640) as an option paragraph
INFO:explainshell.algo.classifier:classified <paragraph 6, DESCRIPTION: '--help display this help and exi'> (0.999215) as an option paragraph
INFO:explainshell.algo.classifier:classified <paragraph 7, DESCRIPTION: '--version'> (0.999993) as an option paragraph
INFO:explainshell.store:inserting mapping (alias) echo -> echo (52207a1fa9b52e42fb59df36) with score 10
successfully added echo
Note that if you've setup using the docker instructions above, echo will already be in the database.