We can make use of the diff command to compare two files in bash shell.
Syntax:
diff <file1> <file2>
Example:
bash-3.2$ cat data1.txt
date,temp
21-07-2023,10.1
22-07-2023,11.2
23-07-2023,11.5
bash-3.2$ cat data2.txt
date,temp
21-07-2023,10.1
22-07-2023,11.2
23-07-2023,11.5
24-07-2023,11.2
bash-3.2$ diff data2.txt data1.txt
5d4
< 24-07-2023,11.2
bash-3.2$
Screenshot:

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Bash,
- Bash Hello World! Script Tutorial
- How to run bash command in background
- How to create new user account in Windows bash
- How to Compare Strings in Bash
- Bash: Allow Command to Fail without exiting Script
- Fix bash: script.sh: Permission denied Error
- Bash getopts Command Example
- How to fix bash ping command not found error
- How to add NewLine Character in Bash Script String
- How to Echo Bash Command to a File
- Bash Command to Find String in a File
- How to open new Terminal using Bash Command
- Bash How to Save Output of a Command to a Variable
- Download a SSL Certificate from a URL in Terminal
- Bash Command to Check IP Address
- Know Bash shell version command
- Bash Command To Check If File Exists
- How to run a Command in Bash Script
- How to Compare two Files in Bash Shell
- How to check if a variable is set in Bash Script or Not
- Convert String from uppercase to lowercase in Bash
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- Bash Command To Get Current Time
- Bash command to List Files
- Fix: bash: syntax error near unexpected token
More Posts:
- PowerShell: Steps to Connect to connect to Exchange Online - Powershell
- How to Configure Eclipse keymap in IntelliJ IDE - Android-Studio
- Fix: 403 Forbidden/Access Denied Error during Windows Software Updates - Windows
- Bash For Loop Example - Bash
- How to Prevent Mac from sleeping - MacOS
- How to update Python Version on Mac (macOS) - MacOS
- Help or Man equivalent in PowerShell - Powershell
- How to Schedule Mails in macOS Ventura - MacOS