Skip to main content

Questions tagged [diff]

diff is a shell command to find differences between two files. It is common on all *nix based systems

476 votes
18 answers
870k views

How do I compare binary files in Linux?

I need to compare two binary files and get the output in the form <fileoffset-hex> <file1-byte-hex> <file2-byte-hex> for every different byte. So if file1.bin is 00 90 00 11 in ...
user avatar
113 votes
2 answers
47k views

Ignore .svn when doing `diff -r`

diff has an option --recursive (-r) to do a comparison between two directories (the files inside them). Is there a way to make diff ignore certain sub-directories (eg: .svn)? $ diff -r src1/ src2/
Sridhar Ratnakumar's user avatar
110 votes
10 answers
106k views

How can I diff two XML files?

On Linux, how could I generate a diff between two XML files? Ideally, I would like to be able configure it to some things strict, or loosen some things, like whitespace, or attribute order. I'll ...
qedi's user avatar
  • 1,621
83 votes
6 answers
71k views

How can I diff binary files in git?

In order to diff binary files in git, I assume I need to set up a difftool. What difftools work? How do you put the parameters in?
Nick Retallack's user avatar
67 votes
13 answers
64k views

Linux: Compare Directory Structure Without Comparing Files

What is the best and simplest way to compare two directory structures without actually comparing the data in files? This works fine: diff -qr dir1 dir2_ But it's really slow because it's comparing ...
Jonah's user avatar
  • 935
61 votes
7 answers
92k views

How to print files that would have been changed using rsync?

Is there a way to get rsync to print the full filepaths to all files that are different without actually transferring any files? Alternatively, I need a way to diff the files across two trees (over ...
Joe Tsai's user avatar
  • 619
57 votes
4 answers
45k views

vimdiff: Jump to next difference inside line?

vimdiff is very handy for comparing files. However, I often use it on files with long lines and relatively few differences inside the lines. vimdiff will correctly highlight differences inside a line ...
sleske's user avatar
  • 23.2k
56 votes
1 answer
51k views

diff directories, excluding one folder inside

I think I have two directories with the same content, but I want to check it. Also, I want to exclude a folder that is inside both directories. How can I do it?
tirenweb's user avatar
  • 1,359
54 votes
7 answers
30k views

How can I enable colored output for OSX diff?

I need to diff two files (not two versions of the same file, they are however tracked by git, but that is unrelated) and I would like some colored output, how can I achieve that? $ diff file_1 file_2 ...
miphe's user avatar
  • 1,019
44 votes
6 answers
40k views

How to diff large files on Linux

I'm getting a diff: memory exhausted error when trying to diff two 27 GB files that are largely similar on a Linux box with CentOS 5 and 4 GB of RAM. This is a known problem, it seems. I would expect ...
Tom B's user avatar
  • 441
42 votes
3 answers
39k views

Listing lines from just one file in DIFF

I would like to get (GNU)DIFF to printout only lines that are different in one file. So given ==> diffa.txt <== line1 line2 - in a only line3 line4 changed line5 ==&...
justintime's user avatar
  • 3,301
42 votes
4 answers
23k views

Using diff on a long one line file

I have a file that has only one line. Its size is about 20,000 bytes. The file has been modified, and I wanted to know where. I thought using diff, but it shows me the complete line, because it ...
jperelli's user avatar
  • 565
41 votes
5 answers
73k views

How do I do a binary diff on two identically sized files under Linux?

I have two identically sized files, and I need to do a binary diff to check whether they're the same. I'm currently runnnig diff file1.img file2.img but it's taking quite a while to process my 4 ...
Jon Cage's user avatar
  • 2,607
39 votes
4 answers
36k views

How to diff file names in two directories (without writing to intermediate files)?

I am trying to do something along the lines of: diff `ls -1a ./dir1` `ls -1a ./dir2` But that doesn't work for obvious reasons. Is there a better way of achieving this (in 1 line), than this? ls -...
bguiz's user avatar
  • 2,091
38 votes
11 answers
87k views

How can I compare big files under Windows? [closed]

I'd like to compare two files under Windows, each about 1Gb in size. I tried Total Commander and WinMerge, but both ended with Out of memory errors. I'm running Vista Home Premium 64bit with 8GB of ...
Piotr Dobrogost's user avatar

15 30 50 per page
1
2 3 4 5
20