sloccount command not found

In this troubleshooting guide we learn how to fix sloccount command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

sloccount: command not found

or when using sudo you get the following error message

sudo: sloccount: command not found

Solutions to sloccount: command not found

How To Fix sloccount: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu sloccount is provided by sloccount package.

sloccount is:

SLOCCount (pronounced “sloc-count”) is a suite of programs for counting physical source lines of code (SLOC) in potentially large software systems (thus, SLOCCount is a “software metrics tool” or “software measurement tool”). SLOCCount can count physical SLOC for a wide number of languages; listed alphabetically, they are: Ada, Assembly, awk, Bourne shell, C, C++, C shell, COBOL, C#, Erlang, Expect, Fortran, Java, lex/flex, LISP (including Scheme), Makefile, Modula3, Objective-C, Pascal, Perl, PHP, Python, Ruby, sed, SQL, Tcl, VHDL, XML, Yacc/Bison.

SLOCCount can automatically determine if a file is a source code file or not, and if so, which language it’s written in. As a result, you can analyze large systems completely automatically. SLOCCount also includes some report-generating tools to collect the data generated and present it in several different formats.

To fix this problem, we can install more using the command below.

sudo apt-get -y install sloccount

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install sloccount.

sudo apt -y install sloccount

Or if you have aptitude installed you can use the following command.

sudo aptitude install sloccount

Summary

In this tutorial we learn how to fix sloccount command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.