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/
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.
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
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:
Use of hotcopy for safety/stability of the backups.
Find files recursively that were updated in the last hour ignoring SVN files and folders. Incase you do a full svn up on accident.
With the force options the same results can be achieved
Standard command, but I always have to search for it... ;-)
list top committers (and number of their commits) of svn repository.
in this example it counts revisions of current directory.
Number of files in a SVN Repository
This command will output the total number of files in a SVN Repository.
This will merge all of the changes from {rev_num} to head on the branch to the current working directory
Get the svn info, grep for the "URL" of the repository, pull out the tag/branch/trunk, and then just show the helpful/meaningful bit.
Lists the local files that are not present in the remote repository (lines beginning with ?)
and add them.
Dumps a compressed svn backup to a file, and emails the files along with any messages as the body of the email
Use color escape sequences and sed to colorize the output of svn stat -u.
Colors: http://www.faqs.org/docs/abs/HTML/colorizing.html
svn stat characters: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.ref.svn.c.status
GNU Extensions for Escapes in Regular Expressions: http://www.gnu.org/software/sed/manual/html_node/Escapes.html
No need for grep, let awk do the match. This will not behave properly if the filenames contains whitespace, which is awk's default field separator.
This command can be used to revert a particular changeset in the local copy.
I find this useful because I frequently import files into the wrong directory. After the import it says "Committed revision 123" or similar. to revert this change in the working copy do:
svn merge -c -123 .
(don't forget the .) and then commit.
When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them!
svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!
This should handle whitespaces well and will not get confused if your filenames have "?" in them
the output of svn log is annoying to grep, since it spreads the useful info over multiple lines. This compacts the output down to one line so eg you can grep for a comment and see the rev, date & committer straight away.
Updated: MUCH shorter, easier to remember. Now it just replaces newlines with spaces, except on '---' lines.
afaik, svn doesn't have a good, scriptable way of telling you these two basic pieces of information.
make usable on OSX with filenames containing spaces. note: will still break if filenames contain newlines... possible, but who does that?!
This is useful for piping to other commands, as well:
svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$' | xargs $EDITOR