Total lines of code
Problem
Suppose we need to know total lines of code for our git repo
Solution
git ls-files | xargs file | awk 'BEGIN { FS = ":" } ; $2~/text$/ {print $1}' | xargs cat | sed '/^\s*$/d' | wc -l
Written by Sergey Zabolotnov
Related protips
2 Responses
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/68327/dDDVG52ehMM.jpg)
Another way to do this https://coderwall.com/p/ap8i-w
over 1 year ago
·
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/26077/0474e465f54e54cc1225d67dfd5d9be5.jpeg)
It would be better if we could exclude the libraries from this count. For eg: JS libraries that you didn't write.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#