Assumed dir A, B, C are subdirs of the current dir Exact syntax of the command is: rsync -v -r --size-only --compare-dest=/path_to_A/A/ /path_to_B/B/ /path_to_C/C/ (do not omit end-slashes, since that would copy only the names and not the contents of subdirs of dir B to dir C) You can replace --size-only with --checksum for more thorough file differences validation Useful switch: -n, --dry-run perform a trial run with no changes made
Outputs the number of different pixels. 2 params to increase tolerance: * thumbnails size * fuzz, the color distance tolerance See http://en.positon.org/post/Compare-/-diff-between-two-images for more details.
Useful for checking if there are differences between last and penultimate command.
The normal output of 'diff' is a wonderful thing. But just sometimes, you want something that is a little more... well... readable. This is that command. -d - (optional) find the minimal set of changes -b - (optional) ignore changes in the amount of whitespace -B - (optional) ignore changes that just insert or delete blank lines -y - this is where the magic happens! Use the side-by-side output format. -w $COLUMNS - more magic! Instead of using 80 columns, use the current width of the terminal.
Compare the ls -Rl output of two directories in meld (you can also use diff -y instead of meld).
This command stores data in the following files: files.txt, links.txt
Find and read all symbolic links in /path1 and stores list in links.txt
find /path1 -type l -exec readlink -f {} \; > links.txt
Find all files in /path2 and stores list in files.txt
find /path2 -type f > files.txt &&
Displays lines in files.txt that do not exist in links.txt
grep -Fxv -f links.txt files.txt
Show Sample Output
Compare the content of the files in the current directory with files of the same name in the duplicate directory.
Pop Quiz: You have a duplicate of a directory with files of the same name that might differ. What do you do?
You could use diff to compare the directories, but that's boring and it isn't as clever as find -print0 with xargs.
Note: You must omit stderr redirect 2>/dev/null to see the list of missing files from DUPDIR, if any.
Hint: Redirect stderr to a new file to produce a more readable list of files that are missing from DUPDIR.
Warning: This doesn't tell you if DUPDIR contains files not found in the current directory so don't delete DUPDIR.
Show Sample Output
This commands will make it easier to select only common items between two files being compared. If your lines start with things other than lowercase a-z, adjust this Regex appropriately. Number of lines in the output has been set to no more than 10000, and should be adjusted as needed.
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.
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: