Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

Counting the number of lines of C code in a source code directory

At some point, most programmers need to count the Lines of Code (LOC) in their C program files The code for this task is as follows:

$ find source_code_dir_path -type f -name "*.c" -print0 | xargs -0 wc -l 
If you want more statistics about your source code, a utility called SLOCCount, is very useful. Modern GNU/Linux distributions usually have packages or you can get it from http://www.dwheeler.com/sloccount/.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985