Have you have ever found yourself many times in a situation where you would wish to access your files, pentesting procedures, cheatsheets, payloads, guides and notes? Have you ever wished you had a tool that had all of the notes you needed just at the point you want them? These are very important questions that administrators, developers and pentesters have especially when they encounter a problem they had solved before and in one way or another have forgotten how they fixed it. This guide bids all developers, administrators, pentesters and designers alike welcome to kb.

kb is a text-oriented minimalist command line knowledge base manager. kb can be considered a quick note collection and access tool oriented toward software developers, penetration testers, hackers, students or whoever has to collect and organize notes in a clean way. Although kb is mainly targeted on text-based note collection, it supports non-text files as well (e.g., images, pdf, videos and others).

The developer of kb found himself too frequently spending time trying to search for that particular payload list quickly, or spending too much time trying to find a specific guide/cheatsheet for a needed tool. kb tries to solve this problem by providing you a quick and intuitive way to access knowledge. Basically, kb provides a clean text-based way to organize your knowledge.

Features of kb knowledge base manager

With kb a user is able to quickly and efficiently:

  • Collect items containing notes, guides, procedures, cheatsheets into an organized knowledge base;
  • Filter the knowledge base on different metadata: title, category, tags and others;
  • Visualize items within the knowledge base with (or without) syntax highlighting;
  • Grep through the knowledge base using regexes;
  • Import/export an entire knowledge base;

The following are needed to get kb installed in your Linux system

  • Python 3.6 and above

In case you are interested in getting such a tool to manage your notes and your cheatsheets, this guide goes ahead to install and illustrate how to put it to use. Simply follow the following steps.

Step 1: Update your system

Make sure your computer’s operating system is up to date

sudo apt update && sudo apt upgrade


sudo yum update

Step 2: Install Python 3

Since Python is the main package kb depends on, let us go ahead and install it in case you do not have Python, follow the following steps

Install Python 3.6+ on Ubuntu

If you are using Ubuntu 16.10 or newer, then you can easily install Python 3.6 with the following commands:

sudo apt-get update
sudo apt-get install python3 -y

If you’re using another version of Ubuntu (e.g. the latest LTS release) or you want to use a more current Python, we recommend using the deadsnakes PPA to install Python 3.8:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8 -y

Install Python 3.6+ on CentOS

If you are on CentOS 7 or 8 all you need to do to install Python 3 is run the following command.

sudo yum install -y python3

Step 3: Installing kb with pip

To install the most recent stable version of kb just type:

$ sudo pip3 install -U kb-manager

Collecting kb-manager
  Downloading https://files.pythonhosted.org/packages/62/58/6d4ade9e89510816bfda4ffe33967b4ed2d923dedf41300b1e851d4f7ee3/kb_manager-0.1.5-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 28kB/s
Collecting colored (from kb-manager)

The developer recommends the following kb bash aliases for GNU/Linux and MacOS users which affords them a better user experience

cat <<EOF > ~/.kb_alias
alias kbl="kb list"
alias kbe="kb edit"
alias kba="kb add"
alias kbv="kb view"
alias kbd="kb delete --id"
alias kbg="kb grep"
alias kbt="kb list --tags"

After that is done, run the following commands to commit them.

echo "source ~/.kb_alias" >> ~/.bashrc
source ~/.kb_alias

To upgrade kb, run the following command frequently to get the latest stable code and patches

sudo pip3 install -U kb-manager

Installation with homebrew

You can install kb with Homebrew as well. To do so, run the following commands:

brew tap gnebbia/kb https://github.com/gnebbia/kb.git
brew install gnebbia/kb/kb

And to upgrade with homebrew:

brew update
brew upgrade gnebbia/kb/kb

Install on Arch Linux | Manjaro

For Arch users, do not fret or feel down, you can get kb as well by running the following commands. Make sure you have Yay AUR Helper.

sudo pacman -S python3
yay -S python-kb

Step 4: Using kb knowledge base management tool

The following are some of the things that you can do with kb.

Create a new artifact

To start using kb, we need to create a new artifact/note from scratch. To create one, the following command will open a text editor that has been mapped to $EDITOR environment variable. Mine will open vi editor.

kb add --title "sftp" --category "notes" --tags "protocol;network"

On the editor, you are free to add your notes as follows:

#To run sftp command, the following is the Syntax
sftp [email protected]

List artifacts

After you add your artifacts, you can list all of them as follows

$ kb list

   [ ID ]  Title                Category             Tags
 - [  0 ]  sftp                 notes                protocol;network 
kb list

Add a file to the collection of artifacts

If you have a file with your procedures and your notes, you can add it to kb directly. I have a file in my home directory that I will add to kb. You can do the same.

$ ls ~

Add the file to kb in the default Category as follows:

kb add ~/Install-and-Use-kb.txt

List the file added

$ kb list
   [ ID ]  Title                  Category             Tags

 - [  0 ]  Install-and-Use-kb.txt default       
 - [  1 ]  sftp                   notes                protocol;network 
kb list 2

If you would wish to specify a different category, do as follows:

$ kb add ~/Install-and-Use-kb.txt --title install_guide --category "procedure" \
    --tags "kb;install" --author "tech" --status "draft"

List the kb files added

   [ ID ]  Title                  Category             Tags

 - [  0 ]  Install-and-Use-kb.txt default
 - [  1 ]  install_guide          procedure            kb;install
 - [  2 ]  sftp                   notes                protocol;network    
kb list 3 1

Delete artifacts

Once you have added an artifact and you would wish to remove it from your list, you can delete an artifact. When you list your artifacts, you can see an ID as the first column. This ID can be used to delete an artifact as follows:

kb delete --id 2

Or if aliases are used:

kbd 2

You can delete multiple artifacts by ID as well as follows

kb delete --id 2 3 4

Delete an artifact by name

If you prefer names over IDs, you can use an artifact’s name to delete it:

Let us list our artifacts to get the one you would wish to delete

$ kb list

   [ ID ]  Title                  Category             Tags

 - [  0 ]  Install-and-Use-kb.txt default
 - [  1 ]  Test                   test                 protocol;network    
 - [  2 ]  install_guide          procedure            kb;install
 - [  3 ]  sftp                   notes                protocol;network 

Let us delete the Test title

kb delete --title Test --category test

View artifact

We have artifacts already added, so how do we view them? Well, viewing your notes is pretty simple. You can use an id or name just like in deleting an artifact. List all of your artifacts then view the one of your choice by id

   [ ID ]  Title                  Category             Tags

 - [  0 ]  Install-and-Use-kb.txt default
 - [  1 ]  install_guide          procedure            kb;install
 - [  2 ]  sftp                   notes                protocol;network 

Let us view sftp note with ID 2.

$ kb view -i 2

#To run sftp command, the following is the Syntax
sftp [email protected]

As you have noticed, viewing your artifact that way does it by showing it on the output terminal. It is wise to know that it can also be viewed within an editor as follows:

kb view -i 2 -e

That will open that note using your default editor and you can edit it if you like.

Grep through artifacts

You can Grep through your knowledge base too! Look at the Hits column which shows the number of times your word has been found in each artifact.

$ kb grep "sftp"

   [ ID ]  Title                  Category             Hits Tags

   [  0 ]  Install-and-Use-kb.txt default              4
   [  1 ]  install_guide          procedure            4    kb;install
   [  2 ]  sftp                   notes                2    protocol;network   

Closing Remarks

kb is an invaluable tool that you cannot do without in your arsenal. If you depend on notes like me, kb will serve you so well in times of need and save you big time especially if you cannot access your precious Git repository. Install kb today and see if you cannot afford to smile. To finish, we thank kb developers and contributors as well as you for staying on the page till the end. We appreciate your continued support.

For more amazing guides, see the following:

Manage Drupal CMS with Drush command-line shell

How To Display Logs of OpenShift Nodes With oc Command

How To use Linux chown command with examples

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here