diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.

learn more… | top users | synonyms

4
votes
1answer
413 views

How to use diff tool to take a diff between directories with libraries and source?

I would like to know if i can use the diff tool to take the difference between two folders which contain sources as well as libraries and executable. Right now i gave diff -Naur dir1/ dir2/ ...
3
votes
4answers
573 views

On Unix how do I get the output from the diff command to look like a man page? Where I can press 'b' or 'f' to read further or back?

You know how when you use the man command to read the manual (e.g. man ls) and you get output that is paginated that you can read from top to bottom by pressing 'f' to go read further down and 'b' to ...
3
votes
5answers
332 views

Kompare-like tool that needs no kdelibs dependencies?

Are there any Kompare-like tools without KDE dependencies? Can be Qt or GTK based.
3
votes
4answers
1k views

Can I get the opposite of `diff -q` — matching identical files without printing their contents

I have a number of files in a directory, and I want to check that they are all unique. For simplicity, let's say I have three files: foo.txt, bar.txt and baz.txt. If I run this loop, I will check them ...
3
votes
3answers
280 views

How to make and apply (patch) one side diff?

I want to make a shell script that updates a config file. The file present on the server has information, like various IP addresses. The new file has more code, from new configs added to the system, ...
3
votes
2answers
2k views

How do I pipe colored diff output to less?

I've been using git diff, which produces colored output. However, I now find I need to use ordinary diff for something, and it's producing a lot of output that is hard to read because of the lack of ...
3
votes
2answers
166 views

How can I get difference ratio using “diff” or other command?

I have two files with thousands lines. I want to get their differences ratio in lines/bytes using diff, vimdiff or other commands, even regardless of the specific differences.
3
votes
1answer
83 views

Compare two files strictly line-by-line, without insertions or deletions

I have two files that essentially contain a memory dumps in a hex format. At the moment I use diff to see if the files are different and where the differences are. However, this can be misleading when ...
3
votes
1answer
92 views

How to create a patch ignoring indentation differences in the code?

I'm trying to create patch a file using diff tool.But facing an issues.The way I am doing is below. I've created one Directory named a and put original file in to it. a/original_file.c Now I have ...
3
votes
2answers
28 views

How to display which file differs from the others

I'm trying to write a script to get info from 5 different places and compare them for differences. The information is simply IP addresses and I have them placed in text files. I'm using: diff ...
3
votes
1answer
75 views

How do I diff the outputs of two commands?

How can I use the diff command to compare 2 commands' outputs? Does something like this exist? diff ($cat /etc/passwd) ($cut -f2/etc/passwd)
3
votes
2answers
132 views

Comparing files in unix columnwise

I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A: 1,kolkata,19,ab ...
3
votes
3answers
377 views

How to diff two folders by inodes

I'm currently using a script to backup files on my computer. In a nutshell, it works like this: rsync --link-dest=$FOLDER/current $SOURCE $DESTINATION However, I think that my script may be ...
3
votes
2answers
3k views

how to include a new file into a patch

I try to make a patch as introduced here. Say I have two directories pp1(modified version) and pp0(clean version), I make a patch file pp0.patch with the diff command: diff -crB pp0 pp1 > ...
3
votes
1answer
3k views

What does 'patch unexpectedly ends in middle of line' mean?

This is the output of my patch command: Hunk #11 merged at 4184,4190. Hunk #12 merged at 4444. Hunk #13 merged at 4944. Hunk #14 NOT MERGED at 5106-5116. Hunk #15 merged at 5290. Hunk #16 merged at ...
3
votes
1answer
93 views

Identify duplicate blocks of text within a file

Is there a convenient way to identify duplicate or near duplicate blocks of text within a file? I want to use this for identifying code duplication. It looks like there are specialty programs with ...
3
votes
3answers
2k views

Alternative to diff with progress for massive directory compare?

I just rsync-ed 2,000,000 files (3TB) from one RAID to another. I want to make sure my data is intact. rsync -c takes a really long time. diff doesn't show me what it's doing. Is there an ...
3
votes
1answer
535 views

How to pipe diff into Kompare?

I want to quickly compare files in two different directories to see if the files are the same (same content). I want to see the results in Kompare (I'm on KDE - Kubuntu 12.04). Here's my diff ...
3
votes
1answer
89 views

How-to diff distributions?

I am using a Raspberry Pi. There seem to be all kinds of linux distributions, all in .img Format that I use Win32DiskImager for to burn to SD-card. How do I find out, which files were changed(some ...
3
votes
1answer
43 views

git diff of copies that only added lines

Say I have two processes that append lines to copies of the same original (parent) file (copy_A and copy_B). If I diff these copies, can diff ever conclude that we have a conflict? (i.e. can it ever ...
3
votes
2answers
2k views

Difference of folders and files

I have two folders which have different folders inside. Those folders also contains different files. I am looking for the command that would give me the difference between those two parent folders. ...
3
votes
3answers
260 views

Track daily directory changes (and email them)

I have a Debian powered NAS server (ReadyNAS) with a deep file hierarchy. I'd like to get notified daily about what has changed in some of its directories and their subdirectories. So if someone ...
2
votes
1answer
2k views

Diff the output of two `awk` commands

I'm trying to compute the difference between the output of two awk commands but my simple attempts at it seem to be failing. Here is what I'm trying: diff $(awk '{print $3}' f1.txt | sort -u) $(awk ...
2
votes
2answers
213 views

How to determine if file is just a permutation of another one?

Consider for example a source code file, where the functions are drastically shuffled around. Is there is a command to check if the reordering of lines is the only change? (that means no lines are ...
2
votes
3answers
2k views

Comparing text files using Bash and AWK

I have two text files, and I want to compare their corresponding values according to their rows and columns. By comparing, I mean to check if the values are equal and echo if the values are the same ...
2
votes
1answer
134 views

diff --git unknown option

when I try to run diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c I get unknown option (I have installed git via apt-get install git)
2
votes
1answer
705 views

Pipe diff file into patch?

Is there a way to pipe the diff output into patch? The -i parameter is for specifying a diff file, but I just want to do it more dynamically, since I will be updating regularly against a directory ...
2
votes
3answers
103 views

Is cmp faster than diff -q?

In a recent AU question on checking whether some files have differing content, I saw a comment stating that if the differing sections didn't matter, cmp would be faster than diff. This SO answer ...
2
votes
2answers
86 views

How can I show the number of positions lines have moved in diff output?

top1 1,facebook.com 2,google.com 3,youtube.com 4,yahoo.com 5,wikipedia.org 6,baidu.com 7,live.com 8,amazon.com 9,qq.com 10,twitter.com top2 1,facebook.com 2,google.com 3,youtube.com 4,yahoo.com ...
2
votes
2answers
231 views

What does -u of diff really do?

Looks like -u can take an extra number argument, but I don't quiet get the manual, It says, -u, -U NUM, --unified[=NUM] output NUM (default 3) lines of unified context Someone name an ...
2
votes
3answers
503 views

Diff 2 files ignoring strings between @ and [

I am comparing two files. I am trying to ignore the alphanumeric characters after @ and before [ . A line looks like model.Field@d6b0d6b[fieldName
2
votes
2answers
81 views

How can I compare two files based on the value of the first column?

I want to compare two files based on the value of their first column: file1 aaa 23 3 bbb 56 6 ccc 45 2 file2 bbb m a aaa a m ccc m m The output file should be: aaa a m bbb m a ccc m m ...
2
votes
1answer
47 views

How can we compare two same directories in linux and list different files

Suppose I have same version of linux kernel but I changed some driver lines. Is there any way to compare these kernels and list the results. The result would be helpful to go back if I changed a lot ...
2
votes
2answers
377 views

Understaning of diff output

I have file1.txt this is the original text line2 line3 line4 happy hacking ! and file2.txt this is the original text line2 line4 happy hacking ! GNU is not UNIX if I do: ...
2
votes
2answers
181 views

Live diff-mode editing in vim

I want a live view of diffs while I am editing a file. vimdiff is able to do something I want, like highlighting the differences between two files. However there are two drawbacks of vimdiff that ...
2
votes
2answers
70 views

Keep patch in sync with changing source

Is there any standard option to create 'patch' P that works on file F in such way that it will keep working correctly when file F changes into F'. So I will either have some mechanism that will ...
2
votes
2answers
48 views

Using Diff on a specific column in a file

Will it be possible to use diff on a specific columns in a file? file1 Something 123 item1 Something 456 item2 Something 768 item3 Something 353 item4 file2 Another 123 stuff1 Another 193 ...
2
votes
2answers
123 views

Using Diff with -y to get side-by-side output

I am trying to use diff with -y to get side-by-side output, but my output gets messed up after about 18 lines. Here is an example, any clue why? (Check from *.java_pool_size=134217728) : ...
2
votes
2answers
1k views

diff binary files of different sizes?

Is there a neat way to see the difference between two binary files? They are mostly the same, but some bytes are changed, and one of the files has sequences inserted in some places. Diffing the ...
2
votes
1answer
121 views

Is there a way to define the preferred merge or diff tool under Unix?

I know that you can define the preferred editor by setting the EDITOR environment variable. My question is if there is a similar solution for setting the preferred merge or diff tool.
2
votes
1answer
2k views

Patching a file (in this case dwm) and failed hunks

I'm trying to add the transparency patch to dwm. I downloaded the .diff file and in my dwm directory ran this: max@linux-vwzy:~/misc/dwm/dwm-5.9> patch < dwm-transparency.diff patching file ...
2
votes
2answers
592 views

Comparing files and their properties

I get information of a certain set of files in my mail every day, which looks like this: 58623208 Sep 14 20:08 blbn_blfbe_drv 57904920 Sep 14 19:54 blbn_cycmn 55814208 Sep 14 06:02 clsa_Upd 38912000 ...
2
votes
3answers
1k views

Total Commander “compare content” like alternative?

I'm searching a GUI [or CLI] tool that can produce output like the Total Commander compare content function does! For example: Are there any that do that? It's a very handy tool and I miss it
2
votes
2answers
64 views

Diff dpkg files with local copies

Is there a way of diffing the dpkg files with the one that are actually installed? Or barring that a way to find ones that have been modified?
2
votes
2answers
60 views

How to show names of files being compared?

I used diff --from-file to compare my Riak dev1 config to the three others. diff --from-file ~/riak/dev/dev1/etc/app.config \ ~/riak/dev/dev2/etc/app.config \ ~/riak/dev/dev3/etc/app.config \ ...
2
votes
3answers
174 views

Hot to make diff check a symlink link itself?

In Linux one can use the command diff to check for differences of files. I use it to check for differences across two modules, both copied to /tmp. However, both modules have symlinks, which might ...
2
votes
4answers
2k views

Check whether two directories and their subdirectories are the same

With diff -r I can do this task, however it takes so long because diff checks file's content. I want something that determine that two files are the same regarding of their size, last modified, etc. ...
2
votes
1answer
291 views

password problem when feeding a remote file into diff

When I want to compare a local file with a remote file, any of these usually works: $ ssh remote cat file | diff file - $ diff file <(ssh remote cat file) However, sometimes (especially when the ...
2
votes
1answer
171 views

diff two directories for changes and format output to use for script

I currently try to monitor two directories and subdirectories for changes in files. The directories contain the same set of files, some of them are changed. So I thought I might use the diff command ...
2
votes
1answer
986 views

How to compare two tar archives (including file content, new/removed files, symlinks)?

I have two tar archives (compressed or not compressed), and I want to find all differences in the two archives. Both archives contain a complete file system (i.e. when unpacked, would generate ...