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.

Universal configuration monitoring and system of record for IT.

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



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

A faster ls

Terminal - A faster ls
echo *
2009-04-17 21:40:58
User: kFiddle
Functions: echo
A faster ls

Sometimes "ls" is just too slow, especially if you're having problems with terminal scroll speed, or if you're a speed freak. In these situations, do an echo * in the current directory to immediately see the directory listing. Do an echo * | tr ' ' '\n' if you want a column. Do an alias ls='echo *' if you want to achieve higher echelons of speed and wonder. Note that echo * is also useful on systems that are so low in memory that "ls" itself is failing - perhaps due to a memory leak that you're trying to debug.


There are 4 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Yes, it'll print all filenames quite fast, all in one line, and the use of tr(1) won't work if there's (ugh) spaces in filenames. Also, mapping ls to "echo *" is not a good idea at all. Too many scripts depend on such a vital command as ls(1) and will break in some way or another. Things stored in /bin/ are essential on a *NIX system and should not be tampered with.

Comment by sunny32768 414 weeks and 2 days ago

This might get you out of a scrape in rare circumstances.. but don't alias it! In addition to the previous posters comments, this *will* fail on directories that contain many files as the wildcard will expand beyond the size of the shell parser's command line buffer.

Comment by animoid 414 weeks and 2 days ago

Too much typing, and what are you gaining really? Is your hardware that slow that you notice the difference?

Comment by atoponce 414 weeks and 2 days ago

Here's what you gain:


real 0m0.007s

user 0m0.000s

sys 0m0.008s

echo *

real 0m0.002s

user 0m0.000s

sys 0m0.004s

echo * | tr ' ' '\n'

real 0m0.008s

user 0m0.004s

sys 0m0.004s

I don't notice it much...

Comment by brie 371 weeks and 2 days ago

Timings using an Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz - Ubuntu 9.10 Karmic 64bit

using bash in gnome-terminal:

ls /usr/lib/

real 0m0.563s

user 0m0.030s

sys 0m0.010s

echo /usr/lib/*

real 0m0.086s

user 0m0.020s

sys 0m0.000s

using bash on first console (the infamous Ctrl+F1)

ls provide 0.25s

echo provide 0.024s

seems that "ls" output time is about 6 times "echo" output time

To me prove that echo is faster than ls in pseudo-pure computational time (in bash on gnome-terminal)...better values on first console (echo is 10 times faster than ls)

I disagree totally about aliasing ls due to it's own obvious conclusion in terms of pipings issues.

I found this solution very interesting when I have to simply parse folder content in term of pure strings.

Comment by LucaCappelletti 370 weeks and 4 days ago

Your point of view

You must be signed in to comment.