Questions tagged [diff]
diff is a file comparison utility that outputs the differences between two files.
95
questions
312
votes
4
answers
162k
views
How do I diff the output of two commands?
I had imagined the simplest way to compare the contents of two similar directories would be something like
diff `ls old` `ls new`
But I see why this doesn't work; diff is being handed a big long ...
159
votes
20
answers
204k
views
File and directory comparison tool?
I'm looking for something that will compare directories and files like Beyond Compare does for windows.
Its mainly for use of source control, but I need to use it for deployment as well.
83
votes
5
answers
72k
views
Does "diff" exist for images?
You can compare two text files very easy with diff and even better with meld:
If you use diff for images, you get an example like this:
$ diff zivi-besch.tif zivildienst.tif
Binary files zivi-besch....
58
votes
6
answers
96k
views
Diff reports difference but both lines are the same
I diff-ed 2 files and got
1c1
< 1
---
> 1
Both files contained just "1". How is this different?
30
votes
4
answers
111k
views
How to diff multiple files across directories?
I am trying to find diffs between all files of same names across two copies of a directory (say a working and a backup). For example, I can diff two files of same name in both:
> diff d1/f.cpp d2/...
28
votes
3
answers
70k
views
Best alternative for WinMerge
I need to compare/diff/merge files in an easy way. In Dark ages when i'm a windows user I would use WinMerge. What alternatives for this are available in Ubuntu?
The things I must be able to do:
See ...
18
votes
4
answers
9k
views
How can I "diff" two files with Nautilus?
I have installed Meld and found out it's a great comparing tool. Unfortunately there is no integration with Nautilus 3.2. This means, I can't right click on files and select an option to open them in ...
16
votes
2
answers
25k
views
exit code of diff
If I run diff -q on two files and they are identical, the exit code generated by echo $? is 0; if the files differ, the exit code is 1. Why is that? In what way is the first diff a success and the ...
15
votes
5
answers
8k
views
Difference of two big files
I have "test1.csv" and it contains
200,400,600,800
100,300,500,700
50,25,125,310
and test2.csv and it contains
100,4,2,1,7
200,400,600,800
21,22,23,24,25
50,25,125,310
50,25,700,5
now
diff test2....
15
votes
3
answers
7k
views
meld shows output in unreadable alphabet (Japanese/Chinese?)
I am using meld to visualise a diff between two files. meld shows the diff output in... something like Japanese or Chinese?
Any idea what could happen? A locale issue? What is strange is that when ...
14
votes
2
answers
36k
views
Run diff command to compare all files in directory
I have two folders having in theory an identical folder structure and the same files.
I wish to check for differences between the two copies in the two folders. I can run diff folder1/file1 folder2/...
13
votes
3
answers
16k
views
Diffrence between two dirs?
I have two identical folders, but the are not identical(for example Java installation dir). One dir has one extra file and one file has been changed.
Is there any easy to use tool to check that or do ...
11
votes
3
answers
3k
views
Compare source code files, ignoring formatting differences (like whitespace, linebreaks, ...)
I am looking for an application that can compare two C++ sources and find the code-meaningful differences (to compare versions which may have been reformatted differently).
At the very minimum, ...
9
votes
1
answer
27k
views
Bluetooth USB dongle 5.0 0a12:0001 doesn't work on Ubuntu 20.04
WIRELESS USB DONGLE - BLUETOOTH USB DONGLE - MINI 5.0 - VERSION 5.48 - 0a12:0001
So lately I bought a Bluetooth USB dongle - model no: MLT-5.0-MiNi
I'm using Ubuntu 20.04.1 LTS.
1. After I connected ...
8
votes
2
answers
8k
views
Is there any command line interactive tool like meld?
I usually work on someone else's code base on a remote system and often need to merge code from two different files. For that I have to pull files to my system and meld it and push it back to the ...
7
votes
2
answers
9k
views
Show only right side of --side-by-side diff
I don't seem to find a way around this. Is there a one-liner to get only the right side of a diff --side-by-side output?
For example:
For this: diff --side-by-side file1 file2 I get either of this ...
6
votes
2
answers
5k
views
Simple diff command output
I've seen many examples of the use of the diff command, but none detailing its basic use. Here is the content of the two files I would like to use:
cat -A file1.txt
a$
b$
c$
d$
cat -A file2.txt
b$
c$...
6
votes
1
answer
6k
views
Make the `diff` command look only for differences from a specified range of lines
Is there a way to make the diff command look only for differences from a specified range of lines (from from line to to line), instead of the entire file? I am having difficulty trying to find the ...
6
votes
1
answer
447
views
Tools to diff deb-src packages between Ubuntu and Debian repos
I can already create duplicate repos with the same versions of debs and deb-src packages.
The problem is that I want to find the Ubuntu changes from Debian mainline (not from original source). ...
6
votes
2
answers
5k
views
How to diff two folders to multiple patch files
I'm not much of a unix guy so I'll just go ahead and ask:
I have a following problem - two folders with plenty of subfolders. I need to diff them.
I tried this:
diff -drupN vanila_kernel_3.0.8 ...
5
votes
5
answers
6k
views
Comparing contents of two files
I have two files containing list of all files paths from two hard drives (supposed to be exactly the same), one of which I think has missing files. Both lists have the file path and size, but the ...
5
votes
2
answers
3k
views
Does Ubuntu have any graphical software to compare and merge differences in files? [duplicate]
I want to compare two or more files and merge the differences as needed. I was using Windows but now working on Ubuntu 12.04.
In windows "Beyond compare" made my work easier, but since I ...
5
votes
0
answers
260
views
Is it possible to change default diff tool for apt (or maybe it is for shell)?
I'm not sure is it apt or shell setting or is it a setting at all but whenever there is a conflict on a configuration file while doing apt upgrade I'm presented with these options:
Y or I : install ...
5
votes
0
answers
107
views
File comparison on the command line [duplicate]
There are 2 files, that are almost similar. Say, for example, only 2 lines in one file do not match the contants of another file. Is there a way to make a comparison between these 2 files, and write ...
4
votes
1
answer
14k
views
Can't install "meld"
I'm trying to install meld on Ubuntu (I use VirtualBox on Windows 7) in order to visualize git diff:
sudo apt-get install meld
But, it doesn't succeed:
...
Get:9 http://au.archive.ubuntu.com/ubuntu/...
4
votes
3
answers
9k
views
meld installation issue
I am trying to install the meld diff viewer on Ubuntu 12.04 LTS. When I run
sudo apt-get install meld
I get the following output:
Reading package lists... Done
Building dependency tree
...
3
votes
3
answers
8k
views
Diff command to compare files which are in first directory only
I have 2 folders whose contents I want to compare. For instance I have folder 1 and folder 2. Folder 2 has a lot of new files + some files same as folder 1 but with some changes in contents of these ...
3
votes
1
answer
506
views
How to read bzr diff
original:
if __name__ == "__main__":
myparams = {"server":"mpilgrim", \
"database":"master", \
"uid":"sa", \
"pwd":"secret" \
...
3
votes
1
answer
6k
views
How can I check why diff command failed?
I was running diff --brief -r /home/mateusz/ /media/mateusz/Database/backup_test_tmp_folder/home/mateusz/ command that completed with error code 2. According to documentation "Exit status is 0 if ...
3
votes
1
answer
1k
views
PostgreSQL data diff
Note: this question is not about syncing database schema/structure
Problem
In my web application I have a PostgreSQL database server (PGS) and a (separate machine) business logic server (BLS) which ...
3
votes
2
answers
6k
views
nautilus-compare (meld integration with nautilus) and other nautilus-actions-extra packages not working with Ubuntu 13.04
I had nautilus-compare (and other nautilus-actions-extra packages) perfectly working with Ubuntu 12.04
I've just did a fresh install of Ubuntu raring ringtail, and then I ran
sudo apt-get install ...
3
votes
1
answer
168
views
Passing 2 parameters to "Open with.."
I do a lot of diffing and I would like to have kdiff3 under "Open with...". When from console I execute kdiff3 file1 file2 then kdiff is runned and it compares those two files. however this does not ...
3
votes
1
answer
451
views
How to make 'diff' output line-by-line?
I have a seemingly simple question I can't find answer for.
Say, I have two files:
A
B
C
D
and
A
X
Y
D
When I run diff -U 1000 on these, I get:
A
-B
-C
+X
+Y
D
Instead, I'd like to get:
A
-...
3
votes
0
answers
232
views
Kdiff3 works very slowly in 16.04
After installing 16.04 I've noticed that Kdiff3 worked much slower than in 14.04. In 14.04 it worked well with 200MB files and in 16.04 even 2MB files take around 1-2 minutes to process. And 200MB ...
3
votes
0
answers
493
views
convert normal diff to unified diff or use normal diff in patch
I have a normal diff file but I can't patch with it.
So how can I convert this normal diff to unified diff or patch with normal diff file?
Only in /tmp/ns-allinone-2.26/ns-2.26/common: misc.o
diff -...
3
votes
0
answers
29
views
Nautilus: change "paste" to auto-check copied file against original
Is it somehow possible (maybe with nautilus actions?) to change the behaviour of the "paste" functionality or to add a new paste functionality that does the following:
paste as normal
do a diff of ...
2
votes
2
answers
1k
views
How to find same subfolders in two folders on first level only?
Scenario:
2 main folders, that may have subfolders with the same names (I do not know what names might be duplicated, that's what I am trying to find)
the subfolders have MANY other files & ...
2
votes
2
answers
1k
views
Ingore lines with a specific word with diff
I wonder if diff can ignor differences in lines with a specific word (example: CET).
Example:
9c9
< <set name="ti_zone">CET</set>
---
> <set name="time_zone">CET</...
2
votes
1
answer
2k
views
Cronjob under Ubuntu runs slow
I configured a cronjob (running a bash script) with crontab -e which locally copies some data from one hard drive to another (rsync) and after that compares them (diff).
I executed the script ...
2
votes
1
answer
911
views
How do I make a unified patch with diff?
I have two directories src and src-with-fixes. I want to make a unified patch, so people can download the src dir and the patch file and run patch -p1 < patch.diff and get the fixes in the src dir.
2
votes
1
answer
736
views
Graphical Diff viewer that supports LXDE (Lubuntu)
I've installed a fresh copy of Lubuntu on my netbook for the purpose of development "on-the-go". I've installed most of the tools I need except for one handy one: Meld Diff Viewer.
Meld required ...
2
votes
2
answers
1k
views
Why isn't the diff command working as I expect in this Bash script?
I'm not understanding why the diff command is not working correctly in my script. Can anybody clarify it for me?
Here is the bash script:
#!/bin/bash
SRC="src-folder"
DST="dst-folder&...
2
votes
1
answer
968
views
Compare files in directories with different structures and show differences (20.04)
While this may sound like a task that could be accomplished by rsync, diff and the likes, I haven't managed to succeed.
AFAIK, these tools take the directory structure into account when comparing the ...
2
votes
1
answer
218
views
ZFS Diff - diff delegated permission is needed
When running zfs diff today as non-root, I got an error:
Unable to obtain diffs:
The sys_mount privilege or diff delegated permission is needed
to execute the diff ioctl
Searching diff ...
2
votes
1
answer
176
views
How to pass 3rd arg to diff which is a call to another program with multiple arguments?
I want to use diff to compare a text file with the output of a program.
I realise I can redirect the output of the program to a file and then compare 2 files but was wondering if it is possible to do ...
2
votes
1
answer
1k
views
How do I make diff print duplicates only?
I'm trying to find out which files are present in two compared folders. I'm only interested in comparing filenames.
Adding -s to the command does not do the trick for some reason. I want to reuse the ...
2
votes
1
answer
2k
views
Use vimdiff in place of diff to compare configs during package updates
Sometimes when you perform packages updates, you'll be prompted with action to take when apt tries to update packages which contain updated configs.
I'd like to know if there's a way to invoke ...
2
votes
1
answer
177
views
How to fix a build when trying to patch the original file?
I'm trying to create a package of Bugzilla 4 in a Launchpad PPA. Keep getting a malformed patch and have redid the patch from ground up numerous times without any success. One of the logs can be seen ...
2
votes
1
answer
76
views
How to transfer diff between two different file formats?
I often find it convenient to edit a document in one file format while storing it in another format. For example, a document can be written down in markdown, converted to a word file and edited there. ...
2
votes
2
answers
214
views
using diff to compare a file and a directory
there is probably a simpler way to do this but I ran ls on the /media/user directory with no usb storage plugged in and saved the output to a file and I wanted to use diff to compare the file with a ...