What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Count lines of source code excluding blank lines and comments

Terminal - Count lines of source code excluding blank lines and comments
sloccount <directory>
2011-05-06 13:51:27
User: BohrMe
Count lines of source code excluding blank lines and comments

Much more accurate than other methods mentioned here straight out of the box.


There are 28 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Full sample output:

sloccount .

Creating filelist for arch

Creating filelist for block

Creating filelist for crypto

Creating filelist for drivers

Creating filelist for firmware

Creating filelist for fs

Creating filelist for include

Creating filelist for init

Creating filelist for ipc

Creating filelist for kernel

Creating filelist for lib

Have a non-directory at the top, so creating directory top_dir

Adding /usr/src/kernels/ to top_dir

Creating filelist for mm

Adding /usr/src/kernels/ to top_dir

Creating filelist for net

Creating filelist for samples

Creating filelist for scripts

Creating filelist for security

Creating filelist for sound

Adding /usr/src/kernels/ to top_dir

Creating filelist for tools

Creating filelist for usr

Creating filelist for virt

Adding /usr/src/kernels/ to top_dir

Categorizing files.

Finding a working MD5 command....

Found a working MD5 command.

Computing results.

SLOC Directory SLOC-by-Language (Sorted)

263110 include ansic=261507,cpp=1561,asm=42

33895 scripts ansic=20542,perl=7062,cpp=1795,sh=1714,yacc=1289,


27314 arch ansic=26884,cpp=430

0 block (none)

0 crypto (none)

0 drivers (none)

0 firmware (none)

0 fs (none)

0 init (none)

0 ipc (none)

0 kernel (none)

0 lib (none)

0 mm (none)

0 net (none)

0 samples (none)

0 security (none)

0 sound (none)

0 tools (none)

0 top_dir (none)

0 usr (none)

0 virt (none)

Totals grouped by language (dominant language first):

ansic: 308933 (95.26%)

perl: 7062 (2.18%)

cpp: 3786 (1.17%)

sh: 1714 (0.53%)

yacc: 1289 (0.40%)

lex: 1045 (0.32%)

python: 448 (0.14%)

asm: 42 (0.01%)

Total Physical Source Lines of Code (SLOC) = 324,319

Development Effort Estimate, Person-Years (Person-Months) = 86.61 (1,039.28)

(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))

Schedule Estimate, Years (Months) = 2.92 (35.02)

(Basic COCOMO model, Months = 2.5 * (person-months**0.38))

Estimated Average Number of Developers (Effort/Schedule) = 29.68

Total Estimated Cost to Develop = $ 11,699,374

(average salary = $56,286/year, overhead = 2.40).

SLOCCount, Copyright (C) 2001-2004 David A. Wheeler

SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.

SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to

redistribute it under certain conditions as specified by the GNU GPL license;

see the documentation for details.

Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."

Comment by BohrMe 358 weeks and 4 days ago

That is a lot of work.

Good luck.

Comment by RanyAlbeg 358 weeks and 3 days ago

Your point of view

You must be signed in to comment.