You can use diff command to compare the contents of directories. To compare directories instead of files pass directory path instead of file path in diff command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
## compare contents of directories mkdir mydir{1,2} ## create some files and directories echo "hello" > mydir1/myfile1 echo "world" > mydir2/myfile2 echo "hello" > mydir2/myfile1 diff mydir1/ mydir2/ ## compare the contents of directories ## returns ## Only in mydir2/: myfile2 ## Only in mydir2/: myfile3 diff mydir1/myfile1 mydir2/myfile2 ## compare the contents of files ## returns ## 1c1 ## < hello ## --- ## > world rm -r my* |