I have two directories with the same list of files. I need to compare all the files present in both the directories using the diff
command. Is there a simple command line option to do it, or do I have to write a shell script to get the file listing and then iterate through them?
Unix – Diff files present in two different directories
diff()shellunix
Related Topic
- Linux – Shell command to tar directory excluding certain files/folders
- Linux – Looping through the content of a file in Bash
- Git-diff to ignore ^M
- Bash – How to set a variable to the output of a command in Bash
- Python – Running shell command and capturing the output
- Linux – Given two directory trees, how can I find out which files differ by content?
- Linux – How to recursively find all files in current and subfolders based on wildcard matching
- Linux – What does set -e mean in a bash script
Best Answer
You can use the
diff
command for that:This will output a recursive diff that ignore spaces, with a unified context: