This content originally appeared on DEV Community and was authored by Navraj Sandhu
In this short tutorial we are gonna see how to count lines of code that you've written.
Before we get started you should have node
, npm
, npx
installed in your machine.
Let's start
- Open terminal and cd to your project directory.
- Run the following command
npx sloc .
or you can install sloc
package globaly.
npm install -g sloc
run command with sudo
if you using linux or mac.
then you can run
sloc .
If you want to exclude file or directory( Like venv
or node modules
) you can do like that.
sloc . -e <file>|<directory>
Example :
- Here I have a django project in which i have
venv
folder that i wanna exclude.
Thanks for reading.
Happy coding ?.
This content originally appeared on DEV Community and was authored by Navraj Sandhu

Navraj Sandhu | Sciencx (2021-06-22T05:09:12+00:00) How to count lines of code you written.. Retrieved from https://www.scien.cx/2021/06/22/how-to-count-lines-of-code-you-written/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.