Hot answers tagged

23 votes

How can I get diff to show only added and deleted lines? If diff can't do it, what tool can?

To show additions and deletions without context, line numbers, +, -, <, > ! etc, you can use diff like this: diff --changed-group-format='%<%>' --unchanged-group-format='' a.txt b.txt For ...
iphonedroid's user avatar
13 votes

Difference between `curl -I` and `curl -X HEAD`

From the docs: -X, --request (HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (...
x-yuri's user avatar
  • 2,195
12 votes

Apply multiple .patch files

Accepted answer did not work for me, it seems to assume patch can take multiple patch files on one command line. My solution: find /tmp/patches -type f -name '*.patch' -print0 | sort -z | xargs -t -0 ...
Ben's user avatar
  • 221
6 votes

Does btrfs have an efficient way to compare snapshots?

Current solution: btrfs send --no-data -p SHAPSHOT_OLD SHAPSHOT_NEW | btrfs receive --dump | grep ^update_extent
lustra_pl's user avatar
6 votes

Does btrfs have an efficient way to compare snapshots?

This is supported by the snapshot convenience tool snapper. sudo snapper -c config diff 445..446 Of course this requires you to be using snapper for your snapshots. This snapshot ids can be found ...
Att Righ's user avatar
  • 351
6 votes

Get rsync to generate a patch file instead of copying across files?

For create patch: rsync -arv --only-write-batch=patch new/ old/ For apply it: rsync -arv --read-batch=patch dir/ or use auto-generated script: ./patch.sh Sources: https://russt.me/2018/07/creating-...
FarK's user avatar
  • 159
3 votes

How to compare two directories (including sub directories) for differences?

Diff is normally used to compare two files, but can do much more than that. In diff he options "r" and "q" make it work recursively and quietly, that is, only mentioning differences, which is just ...
Fábio's user avatar
  • 131
2 votes

Apply multiple .patch files

This actually works (in Bash): shopt -s globstar for file in /path/to/patches/**/*.patch do patch -p1 < "$file" done
l0b0's user avatar
  • 1,142
2 votes
Accepted

kubectl diff on PowerShell?

This can be done by installing DiffUtils for Windows. The kubectl diff is using the Unix diff program so Windows will need some help with this. Simply: Install the DiffUtils Make sure the bin folder ...
Wytrzymały Wiktor's user avatar
2 votes
Accepted

Diff local directory and svn repository without checking out the files

No. svn diff can not use irrelevant paths or URLs as parameters, they have to be part of repository or Working Copy. But you can get empty WC from the same root as root of your directory tree, add ...
Lazy Badger's user avatar
  • 3,157
2 votes

shasum of tar file different on os x / ubuntu although files are identical

I just made a test on my Linux Debian and Mac OS and results are exactly the same. Maybe the shasum command is not the reason and it's simply because your ./sha.tar files are not the same. Did you ...
LockTheDoor's user avatar
2 votes

diff gives all-different, but human compare shows equalities

Diff type utilities will compare files on a line by line basis, whereas you seem to be interested whether lines are common to the two files. The comm utility may be what you are looking for, files ...
fvu's user avatar
  • 686
2 votes

How can I check if a directory contains the same files of a TAR archive?

Let's assume that you tarred /etc directory and now you want to compare the tar filelist against the live filesystem. You can use the following commands to generate the filelist, and then diff the two ...
shodanshok's user avatar
1 vote
Accepted

Efficient way of determining whether 2 directories have ANY difference?

I don't know about a program which does this, but it is easy enough to write a small script calling diff and stopping upon the first difference. Like this: #!/bin/bash dir1="$1" dir2="$...
Lacek's user avatar
  • 7,353
1 vote

Load, Compare & Diff Registry of Windows Servers & Clients on VHDs?

If you don't mind Linux, I'd really recommend winregfs. It transforms the hive file contents into plain files and folders that can be accessed and handled by whatever your preferred diffing tool is. ...
mirh's user avatar
  • 167
1 vote

rsnapshot diff between snapshots

The problem I have with "rsnapshot-diff" or even a related "diff_backup.pl" script is they don't take into account files that were renamed and then relinked together. They list them as added-deleted ...
anthony's user avatar
  • 329
1 vote

How do I diff two folders in Windows Powershell?

The following function recursively checks multiple folders (though two at a time) for deletions (only in the former), additions (only in the latter), AND changes (where files sharing a name have ...
Hashbrown's user avatar
  • 331
1 vote

How do I diff two folders in Windows Powershell?

Do this: compare (Get-ChildItem D:\MyFolder\NewFolder) (Get-ChildItem \\RemoteServer\MyFolder\NewFolder) And even recursively: compare (Get-ChildItem -r D:\MyFolder\NewFolder) (Get-ChildItem -r \\...
Francesco Mantovani's user avatar
1 vote

Does btrfs have an efficient way to compare snapshots?

The backup utility btrbk (https://github.com/digint/btrbk) also has a diff (and also a extents diff) subcommand.
Daniel Schaffrath's user avatar
1 vote

Powershell find orphaned processes

I know this is an oldie, but following solution performs quite well: function Get-OrphanedProcesses { $procsWithParent = Get-WmiObject -ClassName "win32_process" | Select-Object ProcessId,...
mwallner's user avatar
  • 136
1 vote

Show files to be patched on .diff file and determine if they are patched or not

I've found a solution. To show the list of files to be processed: lsdiff from patchutils. To determine the patch status of the tree I wrote this sh function: checkpatch(){ local normal reverso ...
Emilio Lazo's user avatar
1 vote

compare directories local and server with diff

diff -q <('sudo ls -1aR /home/spyros/Daily-Backup') <(ssh [email protected] 'sudo ls -1aR Daily-Backup/') The quote ' makes the sudo command act like one string, instead of cmd with args. Remove the ...
AlexT's user avatar
  • 11
1 vote

Diff tool which I can force certain lines to match

diff is a line-based algorithm, but it seems what you want to match are not lines, but blocks of lines. One possibility is to use an intermediate step to put each block on one line by joining the ...
Mark Stosberg's user avatar
1 vote

Does rsnapshot save binary diffs?

It will copy the new file completely in the sense it will write a complete new file, but it can detect changes and only transmit these over the network. Writing only diffs is not possible as ...
Sven's user avatar
  • 99.1k
1 vote

AIX diff not showing the content of a new file

You can install GNU diffutils on AIX if you prefer. Or git for git diff.
John Mahowald's user avatar
1 vote

How can I get diff to show only added and deleted lines? If diff can't do it, what tool can?

I find it simplest to use grep: Added lines: grep -xvFf filea.txt fileb.txt Removed lines: grep -xvFf fileb.txt filea.txt -x: match whole lines -v: lines NOT matching the pattern(s) -F: treat ...
Joshua Goldberg's user avatar
1 vote

How can I get diff to show only added and deleted lines? If diff can't do it, what tool can?

I find this particular form often useful: diff --changed-group-format='-%<+%>' --unchanged-group-format='' f g Example: printf 'a\nb\nc\nd\ne\nf\ng\n' > f printf 'a\nB\nC\nd\nE\nF\ng\n' &...
Ciro Santilli OurBigBook.com's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible