Questions tagged [diff]

diff is a file comparison utility that outputs the differences between two files.

Filter by
Sorted by
Tagged with
2 votes
2 answers
77 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&...
  • 21
0 votes
1 answer
28 views

Move files of Dir1 which do not exist in Dir2 into a new Dir3

I have the following environment: **DirA** file1 file2 file3 **DirB** file1 file2 file4 Desired output: **DirC** file4 I have seen solutions to similar problems with diff, sed, and xargs, but i ...
  • 101
0 votes
2 answers
58 views

Process substitution with diff and pipes

When checking if a key and crt match I usually compare the hashes of the modulus as so: openssl rsa -noout -modulus -in key.key | openssl md5 openssl x509 -noout -modulus -in crt.crt | openssl md5 ...
0 votes
0 answers
30 views

How can I diff two files, deleting lines in file1 from file2 [duplicate]

I want to take file1 and remove all the lines that are contained in file2, ideally keeping the filename file1 once done, keeping the unmodified lines of anything remaining. I've tried using diff as ...
  • 1
2 votes
1 answer
66 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,992
2 votes
2 answers
497 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 & ...
  • 398
0 votes
0 answers
42 views

Colorize diff side-by-side output and put label header on diff

I am writing a bash script to compare 2 folders. The script will collect some user information (folders and files to compare) and afterwards loop through an array to show differences. Something like: ...
1 vote
1 answer
81 views

Cubic install is different than original... why?

Making my first steps in automating the installation of Ubuntu. Found the Cubic package being recommended and I'm trying it out at the moment. One thing I noticed on one of the first runs was that ...
2 votes
1 answer
378 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 ...
1 vote
1 answer
122 views

When does diff use | in a side by side diff?

in the documentation to diff is said under "Showing Differences Side by Side": ‘|’ The corresponding lines differ, and they are either both complete or both incomplete. What does complete ...
  • 11
0 votes
1 answer
103 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 ...
9 votes
1 answer
22k 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 ...
0 votes
0 answers
168 views

Bash script for copying only modified files

I have a very large base dir called proj_base containing humongous amount of files and directories. Mostly every day I create a proj_base_ndate and copy contents previous day folder proj_base_n-1date, ...
  • 1
1 vote
2 answers
874 views

How do I compare equality of two files in Ubuntu?

I have two large pkl files. I'm not interested in knowing the comparisons of the contents of two files (as we do for text files with diff, meld or vimdiff). I suspect that they are the same. Their ...
  • 552
0 votes
2 answers
287 views

How to keep locally changed configuration files in sync with updated vanilla package versions after "apt-get upgrade"?

I'm maintaining Ubuntu 16.04.6 LTS and Debian 4.9.210-1 systems. When I apt-get upgrade, I often get the notice that my local configuration files have changes to the updated package configuration ...
  • 289
4 votes
0 answers
157 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 ...
  • 453
1 vote
1 answer
785 views

I have a zip file. I extracted it and modified some files. How do I list them?

Basically I'd like to do a diff and list binary-changed files recursively in the folder. I want to avoid cluttering the filesystem so I think this involves some piping. I searched some examples but ...
  • 115
0 votes
0 answers
337 views

How to compare two files with without it doing it line-by-line or ignoring words it has already seen before? (Bash Linux)

So I am trying to compare two files. text1.txt and text2.txt and put the difference between the two files in the file text3.txt My issue is that I cannot find a way to make it eighter not check line-...
0 votes
1 answer
231 views

Is it possible to visually view the differences (changes) of text files while copying them with Caja?

I have two files with the same name in two different folders. I need to copy the text file from source to destination. Usually I use Caja's Extra Pane (accessible by F3) for doing so: I remembered ...
  • 92.9k
1 vote
2 answers
121 views

Display changes between old and new server

I am using a headless Linux server in an off-site location and I access it using ssh. I tried upgrading to Ubuntu 18.04 LTS 64bit because of the constant nagging that Ubuntu 14.04 was outdated, yet I ...
  • 21
1 vote
1 answer
1k views

Why is Meld not identifying differences?

Meld is not showing differences. In this minimal example, directories a and b are different, as shown by diff below. $ diff a/ b/ diff a/a.txt b/a.txt 1c1 < a --- > aa Only in b/: b.txt But ...
  • 2,531
0 votes
3 answers
2k views

Comparing two text files and save the missing

I have two text files: first text file: Hello Hi Hola Bonjour Second text file: Hi Bonjour How can I output the differences between them regardless the line number i.e. I want to save the ...
  • 1
6 votes
1 answer
4k 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 ...
  • 223
1 vote
1 answer
417 views

How to configure "flatpak run org.gnome.meld" as git diff.tool and merge.tool

I can't use meld due to a messed up local installation of cairo or else. I've invested some time in it already including reporting the failure as a bug, but the maintainer states that it's not a bug ...
0 votes
1 answer
83 views

Identical content search between files of different names?

I do not know if it is possible to compare the contents of text files among other files in a second folder. I need the program to only search for matching strings and if it finds them, show both lines ...
  • 515
1 vote
0 answers
584 views

Diff side by side output with "|" (incomplete) sign

When I compare two files with just numbers, in addition to < and > signs, I also have | signs at some of the lines. For example, 25746 | ...
  • 23
0 votes
0 answers
3k views

Why does diff in Terminal say "No such file or directory" when the dir. exists?

I am trying to use 'diff' in Terminal in a way that is very similar to half a year ago, but now it doesn't work. I get the "No such file or directory" error even though the directories obviously exist....
  • 871
1 vote
2 answers
730 views

How do you compare two root filesystems - but ignore mount points?

I have rootfs / but within that I have /mnt/another_rootfs which contains a second mounted rootfs. I want to compare the files in them... but when I do somthng like: diff -r / /mnt/another_rootfs I ...
11 votes
3 answers
2k 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, ...
1 vote
0 answers
494 views

Binary diff file

bsdiff uses max(17*n,9*n+m) bytes of memory (where n is the size of the old file and m is the size of the new file) according to http://www.daemonology.net/bsdiff/ Is there a lighter (in terms of ...
  • 107
1 vote
1 answer
350 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 -...
2 votes
1 answer
118 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 ...
  • 173
5 votes
5 answers
5k 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 ...
  • 91
3 votes
0 answers
172 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 ...
0 votes
0 answers
219 views

using DIFF with a remote system

I would like to get the difference between two directories (not files), lets say dir1 on a local system and dir2 which is located on a remote server. From what I could find on the internet, the "best" ...
  • 31
0 votes
1 answer
333 views

Copy differences between two dirs to a a new dir?

Edited version to a rushed question! When I run diff on two directories ex: $ diff Linux1 Linux2 The output being $ Only in Linux2: COMPLETELYDIFFERENT22.txt I want to the copy that file(not just ...
-1 votes
1 answer
495 views

How to perform binary diffing and patching with standard Ubuntu (Debian) tools? [closed]

I have two set of binary files (before and after a certain operation), and I need to perform diffing betwen the sets, and patching on the first set in order to obtain the second set. How can I ...
  • 2,155
2 votes
0 answers
365 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 -...
  • 21
6 votes
2 answers
4k 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$...
2 votes
0 answers
222 views

diff - How to make columns line up

I used Unity Tweak Tool to make some changes and I wanted to find out what keys it used for the changes so I dumped the db to a file like this: dconf dump / > altered_settings.ini Then I reset ...
1 vote
5 answers
2k views

compare contents of two text files in ubuntu?

I need to compare the contents of text files (as a whole and not line-wise like diff command) and print out the missing text. Is there a command to do so? Thanks in advance. EDIT: As an example, say ...
  • 147
6 votes
2 answers
7k 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 ...
1 vote
0 answers
384 views

Meld issue with codification (one file in Chinese chars)

This is odd. Meld has two text files which were generated by the same program on different dates. One comes out fine but the other is unreadable. The issue does not exist in the terminal. I ...
  • 153
3 votes
3 answers
7k 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 ...
1 vote
1 answer
874 views

Exit code "1" on diff command despite getting output

user@mbp$ diff --suppress-common-lines -y file1.txt file2.txt Some output user@mbp$ echo $? 1 user@mbp$ I'm curious why it throws exit code 1 rather 0 if its giving me what I need? I realize ...
  • 80
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 ...
  • 629
0 votes
0 answers
486 views

vim -d colorscheme

I need a readable colorscheme for vim -d (or vimdiff). My problem is that some lines aren't readable (see picture), white text on yellow background: I tried also the following in ~/.vimrc: if &...
  • 1,386
0 votes
0 answers
4k views

How to see difference or compare files using sublime?

Using sublime as notepad++ not available for ubuntu :( I want to see differences among two files one is from repository and another is external file, is there any way to see difference using sublime, ...
  • 153
2 votes
0 answers
391 views

exclude socket files during 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 all socket files and only socket files? I am using diff --...
3 votes
1 answer
5k 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 ...