ks - offline search MDN and other zip dictionaries

Can you code without the Internet?

What's an <article> and how do I upload a file? What if you could have a copy of Mozilla Developer Network at your fingertips, offline. You can keep your hands on the keyboard, it's TUI with interactive, real time fuzzy search.

Update: Install all dictionaries in one go. New dictionaries: Micro, commands, Arduino...

Download 'ks' the offline TUI documentation browser

Currently, ks only supports Linux.

Benefits of ks offline dictionary

  • 100% offline, 100% terminal, 100% keyboard-only
  • Find as you type
  • Instant display of answers
  • Use vanilla zip files as dictioanary, file names are search strings
  • Very short (~50 lines with help text) code is easy to audit. It uses fzf for fast search and unzip to read the files.
  • Minimal dependencies bash, find, unzip and fzf
  • Locally, pydoc3 might tell you what parameters a function takes. But 'ks' has READMEs, howtos, tutorials and quickstarts too. The stuff that you Duck/Google again and again.
  • Free software under GNU General Public License, version 2

Screenshots

Quick Start

You can just download the script and run it. But for clarity's sake, here are detailed steps.

Get the program

$ sudo apt-get update
$ sudo apt-get -y install fzf unzip

$ wget https://terokarvinen.com/2022/ks-kanasirja-offline-tui-dictionary/ks
$ chmod a+x ks

Get a all dictionaries

$ mkdir $HOME/.config/ks/dictionaries/; cd $HOME/.config/ks/dictionaries/
$ wget --continue -nd -np -r -l1 -A '*.zip' https://terokarvinen.com/ks-dict/

Enjoy offline MDN!

$ ks

Getting Dictionaries

You can now download all dictionaries in a single command. All dictionaries are listed on dictionary download page.

Here are some of the first dictionaries described.

Download Mozilla Developer Network dictionary (mdn-2022.zip). The leading reference for everything web: HTML, CSS, vanilla Javascript. It's created by MDN contributors, all 1800+ of them. CC-BY-SA 2.5 and other licenses, see included LICENSE.md in zipfile. 11 311 entries. https://developer.mozilla.org/en-US/

Download DevHints.io (devhints-2022). It has over 300 cheatsheets, from http status codes to postgresql. Created by Rico Sta. Cruz and contributors. 343 entries. https://devhints.io/

Download Go by Example (gobyexample-2002.zip). The basics of Golang programming language. (if err != nil) It's created by Mark McGranaghan and contributors. Go by example is under Creative Commons Attribution 3.0 Unported License. 159 entries. https://gobyexample.com/

Download Hugo Docs 2022 (hugo-2022.zip). Fast static web site generator, single binary, written in Go. Apache-2.0 License. Created by Erik Pedersen and others. 510 entries. https://gohugo.io/documentation/

Download Pandoc User manual, Docs and Wiki 2022 (pandoc-2022.zip). Document generator, e.g. Markdown to PDF. GPL 2 and other licenses. https://pandoc.org/

Download Django docs 2022 (pandoc-2022.zip). Leading Python web framework. https://www.djangoproject.com/

Download Python3 Docs, Language Reference and Library Reference; Third party library docs: requests, pandas, matplotlib, flask. (python3-2022.zip). Everyone's favourite language. Python has multiple licenses and third party libraries have their own. Each license is docmented in the LICENSE* files included with the zip package. 490+ entries. https://docs.python.org/3/

Download Polop Hacktricks 2022 (hacktricks-2022.zip). Penetration testing techniques. Warning: practice safely, disconnect computers from the Internet as needed. Penetration testing with companies requires prior written permission from all parties, and following local laws and many other rules. Created by Carlos Polop. Creative Commons Attribution-NonCommercial 4.0 International. 600+ entries. https://book.hacktricks.xyz/

Download Apache2 docs 2022 (apache2-2022.zip). Apache license. https://httpd.apache.org/docs/2.4/

Download Arduino docs 2022 (apache2-2022.zip). Electronics and microcontrollers rapid prototyping platform. https://www.arduino.cc/reference/en/

There are more dictionaries, and you can now install them all with a three commands.

Place your dictionaries (the zip files) in any directory under

- /home/tee/.config/ks/dictionaries/
- /opt/ks/dictionaries/

Symlinks are followed. You can define more directory paths with environment variable $KSDICTS. Currently, only trusted dictionaries are supported. If you install third party dicts, check that filenames in zips don't try any shell injection funky business.

Creating dictionaries

  • Create a new folder for your dictioary, with a clear and catchy name in lower case. End with dash year. For example, "mdn-2022" or "so-python-2022".
  • Verify license, and save it as LICENSE.md in the directory. Optionally, put license file and original repository URLs on top of this file, and add a date when they were downloaded.
  • Download source material. Many open source projects write their documentation with light markup, such as Markdown or AsciiDoc, with sensible file names. If all useful material is in a subdirectory, take that.
  • Only copy plain text, human readable files to your new dictionary directory.
    • no: png, jpg, gif, mp3, avi, html
    • yes: md go c
  • Create the zip file. It's more convenient to use if you don't create entries for directories.
$ zip -r --no-dir-entries mdn-2022.zip mdn-2022/

Download 'ks' the offline TUI documentation browser

Adminstrivia

This page has been updated many times. More dictionaries have been added.