commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
All with only one pipe. Should be much faster as well (sort is slow). Use find instead of ls for recursion or reliability.
Edit: case insensitive
There are 2 alternatives - vote for the best!
... plus do a sort according frequency
Works on current directory, with built-in sorting.
Get the longest match of file extension (Ex. For 'foo.tar.gz', you get '.tar.gz' instead of '.gz')
Just a little simplification.
If your grep doesn't have an -o option, you can use sed instead.
If you can do better, submit your command here.
You must be signed in to comment.