Install Tokei on Raspberry Pi

Tokei is a command line tool which allows to count blank lines, comment lines, and physical lines of source code. This tool displays results in the table. Various programming languages are supported by Tokei.

This tutorial shows how to install Tokei on Raspberry Pi.

Install Tokei

Connect to Raspberry Pi via SSH and download the latest tar.gz file from releases page of the Tokei repository:

sudo wget -qO tokei.tar.gz

Run the following command to extract a tar.gz file to /usr/local/bin directory:

sudo tar xf tokei.tar.gz -C /usr/local/bin

Now tokei command will be available for all users.

We can check Tokei version as follows:

tokei --version

Remove unneeded tar.gz file:

rm -rf tokei.tar.gz

Testing Tokei

For testing purpose, create a main.c file:

nano main.c

Add the following code to a file:

#include <stdio.h>

// Hello world program
int main() {
    printf("Hello world\n");

    return 0;

Next, run tokei command to count lines of code:

tokei main.c

You will get the following results:

 Language            Files        Lines         Code     Comments       Blanks
 C                       1            8            5            1            2
 Total                   1            8            5            1            2

The tokei command accepts directory as argument. Then given directory and all subdirectories will be analyzed. For example, download the Tokei source code from GitHub:

wget -qO tokei-master.tar.gz
tar xf tokei-master.tar.gz

Execute tokei command to analyze provided directory:

tokei tokei-master

Uninstall Tokei

If Tokei is no longer necessary, you can remove executable file:

sudo rm -rf /usr/local/bin/tokei

Leave a Comment

Your email address will not be published. Required fields are marked *