This uses Bash's "process substitution" feature to compare (using diff) the output of two different process pipelines.
:q to quit
Simple way to achieve a colored SVN diff
This can be much faster than downloading one or both trees to a common servers and comparing the files there. After, only those files could be copied down for deeper comparison if needed. Show Sample Output
Diffs two xml files by formatting them first using xmllint and then invoking diff. Usage: diffxml XMLFile1 XMLFile2
Barely worth posting because it is so simple, but I use it literally all the time. I was always frustrated by the limitations that a non-gui environment imposes on diff'ing files. This fixes some of those limitations by colourising the output (you'll have to install colordiff, but it is just a wrapper for diff itself), using side-by-side mode for clearer presentation, and of course, the -W parameter, using tput to automatically insert you terminal width. Note that the double quotes aren't necessary if typed into terminal as-is. I included them for safety sake,
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
Upload/download newer version of any file with less size and high speed.
To remake the new file use
bspatch <oldfile> <newfile> <patchfile>
This form is used in patches, svn, git etc. And I've created an alias for it:
alias diff='diff -Naur --strip-trailing-cr'
The latter option is especially useful, when somebody in team works in Windows; could be also used in commands like
svn diff --diff-cmd 'diff --strip-trailing-cr'...
Show Sample Output
jq is amazing for manipulating json on the commandline, but the developers have some weird ideas about how to handle shell redirections. This command works around them. Further reading: https://github.com/stedolan/jq/issues/1110
It can be hard to spot differences in reformatted files, because of all the diff noise created by word wrapped lines. This command removes all the noise and performs a word-by-word diff. To ignore empty lines, add -B to the diff command. Also, if this is something you do often, you might want to check out the wdiff(1) program.
Output of this command is the difference of recursive file lists in two directories (very quick!).
To view differences in content of files too, use the command submitted by mariusbutuc (very slow!):
diff -rq path_to_dir1 path_to_dir2
Show Sample Output
This will diff your local version of the file with the latest version in svn. I put this in a shell function like so:
svd() { vimdiff <(svn cat "$1") "$1"; }
**NOTE** Tekhne's alternative is much more succinct and its output conforms to the files actual contents rather than with white space removed My command on the other hand uses bash process substitution (and "Minimal" Perl), instead of files, to first remove leading and trailing white space from lines, before diff'ing the streams. Very useful when differences in indentation, such as in programming source code files, may be irrelevant Show Sample Output
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.
Use vim's diff mode to edit two or more files in one window. The '+diffoff!' turns off diff highlighting when the session is started. Use ctrl+w + ctrl+w to switch between windows. Show Sample Output
Is this not the same
Useful for checking if there are differences between last and penultimate command.
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: