Bonsai (盆栽) is nothing but planting in a try. It is old age Japanese art of growing small trees in pots. Now you can do that with your Linux or Unix terminal easily for fun and profit. Let us look into the Bonsai tree generator called cbonsai created in Clang and Bash.
cloned the repo and install it as follows:
# AUR not ready? Set up AUR and we need # packages: # sudo pacman -S --needed base-devel git clone https://aur.archlinux.org/cbonsai-git cd cbonsai-git/ less PKGBUILD makepkg -si
How to install cbonsai on Debian or Ubuntu Linux
You need to compile source code. Naturally, you need to install GNU GCC Compiler and Development Environment under Debian. If you are using Ubuntu, see how to install GNU GCC Compiler and Development Environment using the apt command:
sudo apt update
sudo apt install build-essential git pkgconf
Make sure you install ncurses Library on a Linux to avoid “fatal error: ncurses.h: No such file or directory” on Linux as follows using the apt-get command:
sudo apt install libncurses6 libncurses-dev ncurses-base ncurses-bin
Now compile and install it:
git clone https://gitlab.com/jallbrit/cbonsai
make install PREFIX=~/.local
Here is what we see
cc -Wall -pedantic cbonsai.c -lncurses -ltinfo -lpanel -o cbonsai install -TDm 0755 cbonsai /home/vivek/.local/bin/cbonsai
How can I install cbonsai on MacOS or *BSD family of operating systems?
The code is portable as coded in C. Compiling on macOS or *BSD is left as an exercise to the readers.
Getting started with our Bonsai tree generator
See each step of Bonsai tree growth
Pass the -l or --live option:
By default, cbonsai waits for 0.03 second in live mode, although we can control TIME in seconds as follows:
cbonsai -l -t 0.06
cbonsai --live --time 0.10
How cool is that? We can seed random number generator too:
cbonsai -l --seed=36677374
cbonsai -l --seed=$(date +%s)
Want to run it in screensaver mode? Try:
We can add message next to the tree as follows:
cbonsai -l -m "Welcome to nixCraft LAB"
We can also print tree to terminal when finished by passing the -p option
cbonsai -l -p -m "Welcome to nixCraft LAB"
It is easy to show help on screen:
It is a magnificent little fun project for desktop users. You can view source code online on project home page. If you enjoyed this Little desktop fun app, you might also like to use the following apps on Linux or Unix systems: