Published on:
Last updated on:
Today I leant a simple and efficient way to find the file difference between two directories recursively
GNU UNIX MinimalismTL;DR it is: diff -qrb SourceDirectory TargetDirectory or diff -urb SourceDirectory TargetDirectory
If you have seen my uses page, you will know that I self-host jitsi meet, and I use docker (actually podman) to deploy it with the instructions present in jitsi handbook for devops.
If you notice, the update instruction asks to download the released zip file and just run the unzip command on it.
This is a problem for me, because I want to know the config changes done between the releases because I did some tweaking and I don’t want them to be overwritten.
I could just version control it, but that is not necessary because I don’t really care about loosing it. So, I usually do a diff on the files I modified.
Today, jitsi released a new version, and I felt lazy, I did a quick man diff and found the following flags.
-b, --ignore-space-change: ignore changes in the amount of white space (well, I knew this before)-r, --recursive: recursively compare any subdirectories found (most important flag)-q, --brief: report only when the files differ (it reports only the file names)
So, I could just run the command diff -qrb jitsi-old jitsi-latest, but qrb is not easy to remember. Going through the man page again, I noticed -u, -U NUM, --unified[=NUM] flag, it outputs NUM (default 3) unified context of diff (i.e, three differences between files, not lines).
rub, urb, and bru are all memorable. But, I don’t want the diffs when doing a recursive check, you may find it useful to run diff -rub SourceDirectory TargetDirectory.
I noticed that -u is ignored when used with -q, so even if I do diff -qurb SourceDirectory TargetDirectory, it gives me the same result.
qurb is also memorable and rolls off the tongue, when I looked it up, it is also an Arabic word for nearness
, closeness
, or adjacency
. So you could say I learnt two things today!
Interactions
No interactions yet.
Send a Webmention
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.