Posted under » Linux on 04 August 2026
We have seen diff in action before but lets dive deeper.
You can use diff for quick code comparison but I recommend that you use meld.
I now mainly use diff to compare file contents in a directory when I do git or svn.
diff --brief --recursive --exclude='*pyc' --exclude='static' /home/ubuntu/heh/ /home/ubuntu/hoh > maindiff.txt
In this command, --brief --recursive is also equal -qr. Exclude 'static' means exclude directories that looks like /static/.
The output will look like this.
Files /home/les/logs/learnerapp.log and /home/dasboot/logs/learnerapp.log differ Only in /home/les/: .git
With that I can change and make sh files like
cp /home/les/logs/learnerapp.log /home/dasboot/logs/learnerapp.log git add /home/dasboot/logs/learnerapp.log