diff ../source-dir.orig/ ../source-dir.post/ | grep "Only in" | sed -e 's/^.*\:.\(\<.*\>\)/\1/g' | xargs rm -r

Compares two source directories, one original and one post configure and deletes the differences in the source folder

Good for when your working on building a clean source install for RPM packaging or what have you. After testing, run this command to compare the original extracted source to your working source directory and it will remove the differences that are created when running './configure' and 'make'.

0
By: bigc00p
2012-10-17 14:12:32

These Might Interest You

  • This will move a folder and merge it with another folder which may contain duplicates. Technically it's just creating hardlinks of everything in the folder, and after it's done, delete the source (with rm -r source/ ) to complete the move. This is much faster than, for example, using rsync to merge folders which would actually copy the entire contents and so for a lot of files would take much longer. This uses macutils gcp port of cp so it can be used on osx/MacOS. If using in linux or some unix where cp includes the ability to create links with -l you can just use cp instead of gcp.


    2
    gcp -r -l source/ destination/
    fivestones · 2017-02-09 23:48:38 0
  • Combines a few repetitive tasks when compiling source code. Especially useful when a hypen in a file-name breaks tab completion. 1.) wget source.tar.gz 2.) tar xzvf source.tar.gz 3.) cd source 4.) ls From there you can run ./configure, make and etc. Show Sample Output


    -1
    wtzc () { wget "$@"; foo=`echo "$@" | sed 's:.*/::'`; tar xzvf $foo; blah=`echo $foo | sed 's:,*/::'`; bar=`echo $blah | sed -e 's/\(.*\)\..*/\1/' -e 's/\(.*\)\..*/\1/'`; cd $bar; ls; }
    oshazard · 2010-01-17 11:25:47 0
  • Creates HTML code from PHP source Show Sample Output


    1
    php -s source.php > source.html
    ruslan · 2011-03-10 15:11:35 0

  • 1
    SRC="/source/folder"; TRG="/target/folder/"; tar cf - "$SRC" | pv -s $(du -sb "$SRC" | cut -f1) | tar xf - -C "$TRG"
    glaudiston · 2015-11-20 22:55:44 2
  • The better alternative to #9756. I don't think I'd ever use the original command, but this one was so bad I had to post this. Sorry. 1. $(ls) is dumb, and will give errors if you have an alias like "ls -Fs" 2. clear is better and more portable than reset state. 3. if you're interested in differences, then use diff, not cat.


    -2
    for f in *; do clear; cat $f; sleep .3; done
    toddkaufmann · 2011-11-25 17:10:47 0
  • You can specify various output formats, theme styles, etc. python -m pygments -o source.png source.py python -m pygments -o source.rtf source.py Check available output formats, styles, etc.: python -m pygments -L Find pygments module here: http://pygments.org/


    1
    $ python -m pygments -o source.html source.py
    antrix · 2009-02-06 08:00:02 1

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands



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: