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

Batch rename extension of all files in a folder, in the example from .txt to .md

Terminal - Batch rename extension of all files in a folder, in the example from .txt to .md
rename .txt .md *.txt
2010-12-19 20:04:37
User: mrwill
Functions: rename
Batch rename extension of all files in a folder, in the example from .txt to .md


There are 3 alternatives - vote for the best!

Terminal - Alternatives
rename 's/.txt/.md/i' *
mmv "*.txt" "#1.md"
2010-12-09 19:14:07
User: houghi
Tags: batch rename

Batch rename extension of all files in a folder, in the example from .txt to .md

mmv most likely must be installed, but is very powerfull when you want to move/copy/append/link multiple files by wildcard patterns.

for f in *.txt;do mv ${f%txt}{txt,md}; done
2010-12-09 18:55:15
User: mobilediesel
Functions: mv
Tags: batch rename

Same thing using bash built-in features instead of a sub-shell.

for f in *.txt; do mv $f `basename $f .txt`.md; done;
2010-12-09 18:29:17
User: vranx
Functions: mv
Tags: batch rename

Batch rename extension of all files in a folder, in the example from .txt to .md

rename 's/\.txt$/\.md$/i' *

Know a better way?

If you can do better, submit your command here.

What others think

rename .txt .md *.txt

syntax error at (eval 1) line 1, near "."

Comment by Juev 305 weeks ago

This version of rename mrwill is referring to comes from the package util-linux-ng, a collection of utilities for linux development.

On the other hand, the rename you're trying to execute comes from Larry Wall and is basically a Perl wrapper.

Some Linux distributions install both of them, usually the first one as 'linux.ul' and the second as 'rename'. Obviously, this is the situation for Juev when trying to execute rename(1).

Comment by xakon 305 weeks ago

I didn't know that! thanks xakon!

my command is alright then! :D

Comment by mrwill 305 weeks ago

Your point of view

You must be signed in to comment.