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

learn more… | top users | synonyms

9
votes
3answers
19k views

Recursively compare two directories with diff -r without output on broken links

I am using diff -r a b to recursively compare directories a and b. It often happens though that there are some broken links (the same broken links in both a and b directories and to the same, ...
4
votes
1answer
130 views

Pass BASH array to diff like file contents

I have two bash arrays, say: arr1=( 1 2 3 ) arr2=( 1 2 A ) and I want to compare them using diff. How could I pass the arrays as if they were the contents of a file? I tried a few variations, but ...
2
votes
2answers
97 views

Find differences in file and sorting file by key

So I have two language files, english and french. They are in this format: key=translation An example in English would be: ui.title=My Title And in French: ui.title=Mon Titre So I need a ...
11
votes
3answers
686 views

Is there a Linux deep diff tool that also compares file attributes?

Is there a Linux tool like diff that will recursively compare files and directories, but with the addition of also comparing: extended attributes, acl's, se contexts?
-1
votes
3answers
86 views

Difference between two files

I have two files , say a & b. I want to compare both the files and get the differences in the third file along with the file name. Can anyone help me out with a simple command.
0
votes
1answer
28 views

blessdiff for the “full featured hexadecimal editor”?

I am trying to find some hex diftool which allows me to compare to documents in the view but also the internal differences like in bless so two bless windows side-by-side but with diff capability ...
2
votes
2answers
235 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)
5
votes
4answers
4k 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: ...
0
votes
1answer
36 views

how to pipe output from git commands into unix diff utility?

I am trying to achieve something along the lines of diff -ywB --suppress-common-lines `git branch --merged prod-server` `git branch --merged test-server` so that I can know the difference of what ...
1
vote
0answers
20 views

Display only relevant hunks of a diff/patch based on a regexp

git log -G<regex> -p is a wonderful tool to search a codebase's history for changes that match the specified pattern. However, it can be overwhelming to locate the relevant hunk in the ...
1
vote
2answers
30 views

How do I generate diffs for a series of files?

I have a series of a few thousand files, all with filenames in order, so let's say file1.x, file2.x, file3.x, etc. All these files are in the same directory. I know how to generate a diff from ...
2
votes
1answer
29 views

Using diff to show both contents of new files and that new empty files are created [duplicate]

After executing these 4 commands, directory "a" has file "1" with contents "test" and file "2" which is empty, and directory "b" is empty. $ mkdir a $ mkdir b $ echo test > a/1 $ touch a/2 We ...
17
votes
2answers
327 views

How do I save the changes to my vim buffer as a patch file?

Is there a way to save the changes I made to my vim buffer as a patch file for the original file, without saving it as a separate file and using diff?
2
votes
2answers
44 views

What optimized tools are available for comparing directory contents?

I am mirroring a Subversion repository tag with svn2git and I want to be sure that when I checkout particular revisions, those I obtain from the git mirror match those from Subversion. My main problem ...
0
votes
2answers
73 views

How to turn Diff command into bash script with prompt

I have a list that i've copy and i want to paste it to the shell to give me just the repeated lines. 1 1 3 2 As i read about bash commands i've maded this: cat > /tmp/sortme ...
1
vote
1answer
50 views

gzip files with cat and from pipe gives different results

Why does this give such output (both commands are supposed to do the same thing) and how can one make them give identical output? diff <(cat some_file | gzip -c - | base64) <(gzip -c some_file ...
2
votes
1answer
68 views

How to compare two directories thoroughly without git?

Here thoroughly means “list all differ files, find those files with same name and different content, list the difference of content”. Before I got a lazy solution, git init one directory and copy ...
1
vote
1answer
543 views

Patch command - can't find file to patch at input line

I generated patch using diff command with the number of context lines as 1 (-c option). My patch file contents: *** /home/sk/abc/def/src/klm/a.py 2015-05-18 16:25:50.348398554 +0530 --- ...
1
vote
2answers
36 views

Getting the diff of a package update

Before (or after) updating a package with apt-get update, how can I view the source code diff between the the new and the old version?
9
votes
3answers
4k views

Run a diff between local and remote files

I'm connected on a host via ssh and I'd like to compare (let's say with diff) a certain config file against its counterpart on an another host, also accessible via ssh, without having to manually ...
3
votes
2answers
158 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 ...
1
vote
1answer
48 views

Diff of directory statistics sumarry (git diff --stat like for non-git repo)

Is there a tool (or diff option combination) which would produce output similar to git diff --stat? I have two kernel sources and I would like to get general idea of what was changed in them. ...
5
votes
3answers
407 views

Compare the heads of two files in bash

I can do diff filea fileb to see the difference between files. I can also do head -1 filea to see the first line of filea or fileb. How can I combine these commands to show the difference between the ...
5
votes
2answers
68 views

Diff Entire Linux Systems

I have a base Linux system installed. I want to run a very large and complex third-party script that will make many changes to various parts of the entire system. These changes will include adding new ...
2
votes
1answer
30 views

Vim and unified diffs

In my daily work, I only deal with unified diffs, so I would like to define the alias alias diff='diff -puN' in my .zshrc. This alias is not respected when I use the shell from the vim command ...
1
vote
2answers
33 views

Diff directories using modification time (mtime) and size instead of contents

Is there an option to have diff (-q) not look at file contents and instead just look at size and mtime? If not, is there a tool similar to this that has the option?
1
vote
1answer
1k views

What is the difference between Copied context output format and Unified context output format while taking diff?

What is the difference between Copied context output format and Unified context output format when taking a diff? diff -NBur dir1/ dir2/ diff -NBcr dir1/ dir2/
2
votes
4answers
257 views

How to make diff command ignore certain lines of second file(bash)?

For example: file1.txt: I need to buy apples. I need to run the laundry. I need to wash the dog. I need to get the car detailed. file2.txt I need to buy apples. I need to run the laundry. I need ...
1
vote
1answer
218 views

Output different lines when comparing two files

I have two text files with the same number of newline terminated strings. The lines in the two files correspond to each other. The lines in each file individually might be repeated. I would like to ...
8
votes
10answers
7k views

linux diff tools: create list of modified files

How do I create a list of modified files programmatically using linux command line tools? I'm not interested in the difference in any particular file (delta, patch). I just want to have a list of new ...
27
votes
5answers
20k views

How to diff files ignoring comments (lines starting with #)?

I've two configuration files, the original from the package manager and a customized one modified by myself. I've added some comments to describe behavior. How can I run diff on the configuration ...
2
votes
1answer
24 views

How to determine the only additional file in otherwise two identical listings?

I have done a listing of the device folder two times, one time without the sd-card in the slot and one time inserted, the system automatically adds one file in the device folder. $ ls /dev | wc -l ...
0
votes
0answers
25 views

What is the meaning of the -u option in the diff command? [duplicate]

In order to determine a certain file, I was told to do: ls /dev | diff -u foo. I looked the man page to the diff command up and found this annotation to the -u option: -u, -U NUM, ...
0
votes
1answer
31 views

Unified Patch: only use diff file

Is it possible to create a diff file that would work without having the actual files in the diff file? e.g.: I have a folder /a and a copy of a: /b. In /b I edit multiple files and create a .diff ...
2
votes
0answers
133 views

Highlight differences between two files, similar to what watch -d produces

The command watch -d produces a very interesting diff: it shows the most recent iteration of the command, and highlights (with inverse video) the differences to the previous iteration. This works ...
2
votes
1answer
143 views

Diff tool with nice output like kdiff3

I like kdiff3 very much due to the way it displays the result. It can compare more than two versions of a file or directory and displays the differences in columns: For directories, it displays ...
18
votes
7answers
7k views

Converting colored output into html

There are tools providing coloured output: dwdiff -c File1 File2 # word level diff grep --color=always # we all know this guy ... The question is: How to convert their colored output of arbitrary ...
9
votes
4answers
6k views

How do you compare two folders and copy the difference to a third folder?

You've got three folders: folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder How do ...
0
votes
1answer
114 views

What does dash “-” mean in Unix command line? [duplicate]

Given this diff command: ./a.out < 1.in | diff - 1.out What does - mean after the word diff? Thanks for the help!
0
votes
1answer
81 views

Compare logs without timestamp

I have a lot of logs I would like to compare. The problem is, that the first few characters in a line are a timestamp. How can I compare logs, ignoring timestamps. For example, these two should be ...
5
votes
4answers
601 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 ...
0
votes
5answers
218 views

Compare one to one lines in 2 different files using shell scripting [closed]

I have two files: File1 File2 abc abc cde cde,xyz,efg,hij,...,n efg lmn,opq,weq,...n Now I want to compare File1 line1 with File2 line1, line2 with line2 and ...
1
vote
2answers
75 views

remove lines from an output file from diff

I have a script that uses diff -c then puts the output on a text file. What I want is to remove the line that does not have the "!" and display the lines with the exclamation mark. Is this possible? ...
1
vote
2answers
281 views

diff two directories, but ignore the extensions

I've got two directories with similar file names but different extensions. Here's an example: DIR1: - IN89284.wav - OUT9920.wav DIR2: - IN89284.mp3 - OUT9920.mp3 I want to compare these ...
1
vote
0answers
53 views

Minimal diff between two texts

The iTunes Store Terms and Conditions just changed. To avoid ending with random parts of my body being sewn to another person's body, I actually read the first version of these Terms and Conditions. ...
1
vote
3answers
626 views

Compare two files and print unmatched lines [duplicate]

I have two files with the below data; I need the difference between two files. I tried with diff but it also shows line which are common in the two files: (22372 Dec 4 15:36 ...
2
votes
2answers
504 views

Compare directory trees regarding file name (and size and date)

I want to check the results of a restore from backup. This is, because TimeMachine on MacOS gives me some weird errors and warnings and I want to make sure, everything is in its place again after ...
4
votes
2answers
190 views

Comparing two files in unix and awk

I have to compare two files, file1 and file2. Each file has 56 columns separated by |. First column is the employee number in the file, I will check whether same employee number is present in the ...
9
votes
3answers
508 views

How do I do an N-way diff?

How do I diff the output of multiple commands? vimdiff can support up to four files, but diff itself seems to support exactly two files. Is it directly possible with some variant of diff, or do I ...
3
votes
2answers
977 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 ...