darker
Posted on August 15, 2022
So, this one is quite simple, let say, you want to count the lines of code you have inside a project, from a file or a whole directory, how are you going to do it ?
HOW
This is done with a simple bash function
loc(){
echo -ne "Lines of Code : ";
if [ -n "$1" ]; then
find . -wholename $1 | xargs wc -l;
else
find . -name '*' -type f | xargs cat | wc -l;
fi
}
Basically, it will find files depending on your input and use wc
to count lines of your code.
You can then add this in your ~/.bashrc
and source before use it or save it in separate shell file that you can call and use when you want !
Thanks for reading, feel free to like and/or subscribe for more 🐼.
💖 💪 🙅 🚩
darker
Posted on August 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.