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

learn more… | top users | synonyms

2
votes
1answer
36 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
23 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
29 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?
1
vote
1answer
16 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
332 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 ...
2
votes
1answer
20 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 ...
5
votes
2answers
62 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 ...
1
vote
2answers
27 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?
2
votes
4answers
127 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
68 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 ...
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, ...
2
votes
1answer
23 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
1answer
20 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
54 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
81 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 ...
0
votes
1answer
59 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
41 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 ...
0
votes
5answers
155 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
40 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
145 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 ...
0
votes
0answers
36 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
309 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 ...
3
votes
2answers
138 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
421 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 ...
2
votes
2answers
427 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 ...
1
vote
3answers
87 views

check if all files from a folder are also in another folder

I basically have a directory a with lots of images. Now I want to check if all of these images are in directory b. The point is, that lots of images in b ain't directly in b but in subdirectories. ...
2
votes
1answer
28 views

`diff -y file-{a,b} | less` and DOS line endings display issues

In my current job I often have to work with files from Windows machines which most of the time isn't a big deal, but when piping a side-by-side diff to less, not only are the ^M being displayed, but ...
2
votes
2answers
314 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 ...
1
vote
1answer
38 views

How to remove data that shows up from 'strings' on a file?

I've downloaded a video via a website that forces a login. Thus, it knows my login. If I run the following on it, I get results that I do not want to have: strings video.mp4 | grep "my user name" ...
1
vote
1answer
98 views

How can I compare 2 files and add lines that aren't on the second file?

I have run into a problem while doing some coding, and I need to compare two files, here is an example input file inputfile1.txt: car php module so js node array and another input file: ...
1
vote
2answers
35 views

Tool for visual directory comparison

This question is not about visual diff -- i.e. file comparison. Is there a tool which let me compare directory A and B (recursively), and as the output I would get two panes, with lists -- files in A ...
0
votes
1answer
81 views

Diff: slightly different filenames, same file

I'm using diff -rq to compare directories on a Mac OS X 10.6 server. In folder1, we have 'filename'. In folder2, we have'filename.archive' because folder2 is created by a file sync app that also ...
0
votes
0answers
19 views

Configuration files difference between 2 dirs of the same app

I have an application installed on 2 machines I upgraded the first application on one server and want to copy the installation from this server to the other one but there is changes in some conf ...
1
vote
1answer
44 views

Different results OS X/Linux with “find PATH -mount \( -type f -o -type d \) -print0 | LC_ALL=C sort --zero-terminated > OUTPUT.txt”

this command is part of a script I use for comparing files: find test/ -mount \( -type f -o -type d \) -print0 \ | LC_ALL=C sort --zero-terminated > OUTPUT.txt // test/ is the PATH ...
3
votes
2answers
38 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 ...
0
votes
1answer
70 views

Is this a good way to create a patch?

I would like to create a patch from a specific gcc branch comparing it to the official releases; so when I unpack the tarball from the stable release, I can apply the patch and get the equivalent of ...
3
votes
2answers
185 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
244 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 ...
9
votes
2answers
807 views

Tool in unix to subtract text files? [duplicate]

I have a large file composed of text fields separated by semicolons in the form of a large table. It has been sorted. I have a smaller file composed of the same text fields. At some point, someone ...
1
vote
1answer
75 views

diff --horizon-lines=lines explained

I found both these quotes on the same diffoption --horizon-lines=lines: Do not discard the last lines lines of the common prefix and the first lines lines of the common suffix. [source] The ...
0
votes
2answers
95 views

check two partitions by selecting random files and running sha1 hashes on two files of each partition

A previous answer to a post mentions to run sha1 hashes on an images of a dd drive clone image. Another answer to that post suggests mounting the dd image an then compare if the sha1 hashes of ...
3
votes
1answer
97 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)
0
votes
0answers
17 views

what does 1d0 mean in diff output? [duplicate]

Say you have two files file1 a b c d file 2 b c d e The first line of diff file1 file2 would be 1d0 I've read up on this and found that it means delete the lines in the first file at ...
0
votes
1answer
39 views

diff files within dirs listing by date modified

I was using MELD but it can't seem to sort by modification time, so I've been looking for a way to achieve something similar in terminal. I found a line of code find /path/to/dir1 /path/to/dir2 ...
7
votes
3answers
965 views

Git pager is less, but what is causing the output coloring?

less itself isn't capable of doing syntax highlighting, according to this thread. However, git diff nicely shows colored output in less, its default pager. When I redirect the output of git diff ...
3
votes
1answer
62 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 ...
2
votes
3answers
308 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 ...
26
votes
4answers
2k views

Result of diff two files with switched lines says missing the same line twice

I am trying to understand the linux diff command on two files whose lines are just permutation of each other but not able to grok the output that it generates. Consider the three commands below: ...
9
votes
3answers
3k 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 ...
1
vote
2answers
163 views

Possible to view two text files side by side (read only)?

In emacs, we can view two text files side by side. Is it also possible to do so in some simpler/lighter applications such as less? Only viewing, no editing.