Bash if two files are identical?

1
Demetris Kuhlman asked a question: Bash if two files are identical?
Asked By: Demetris Kuhlman
Date created: Wed, May 19, 2021 4:57 AM
Date updated: Fri, Aug 5, 2022 9:05 PM

Content

Video answer: 26- diff command -- compare 2 files in unix or linux line by line

26- diff command -- compare 2 files in unix or linux line by line

Top best answers to the question «Bash if two files are identical»

  • To just test whether two files are the same, use cmp -s: #!/bin/bash file1="/home/vekomy/santhosh/bigfiles.txt" file2="/home/vekomy/santhosh/bigfile2.txt" if cmp -s "$file1" "$file2"; then printf 'The file "%s" is the same as "%s"n' "$file1" "$file2" else printf 'The file "%s" is different from "%s"n' "$file1" "$file2" fi

Video answer: How to compare files and directories using the diff…

How to compare files and directories using the diff…

Your Answer

Video answer: Transfer files via scp to an ec2 instance

Transfer files via scp to an ec2 instance