Hide

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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

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.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

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
1
Count lines of source code excluding blank lines and comments

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

Alternatives

There are 2 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/2.6.35.12-90.fc14.i686/./Makefile to top_dir

Creating filelist for mm

Adding /usr/src/kernels/2.6.35.12-90.fc14.i686/./Module.symvers 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/2.6.35.12-90.fc14.i686/./System.map to top_dir

Creating filelist for tools

Creating filelist for usr

Creating filelist for virt

Adding /usr/src/kernels/2.6.35.12-90.fc14.i686/./vmlinux.id 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,

lex=1045,python=448

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 171 weeks and 6 days ago
11,699,374

That is a lot of work.

Good luck.

Comment by RanyAlbeg 171 weeks and 6 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts