x

DIFF Command in Unix

Prev     Next

Diff command in UNIX :

  • This command is mostly used to compare the 2 files and shows the difference between the 2 files.
  • First let’s see the content of the 2 files, so that it will be easy to understand how the diff command displays the results.

Below are the content of the 2 files,


  • The first 2 lines of the 2 files are same and the second file has the extra 2 different contents. Hence the diff command shows the details on the difference as below.It also shows the line number which has difference.
  • Based on our example, the lines 3 and 4 are having the difference.

Example for Diff command in UNIX:

diff file.txt test.txt

Other UNIX Commands:

Below are the list of basic UNIX commands used in UNIX operation system.


1. ls Command in Unix
2. Man Command in Unix
3. More Command in Unix
4. Vi or View Command in Unix
5. Touch Command in Unix
6. Mv Command in Unix
7. Cp Command in Unix
8. Rm Command in Unix
9. Cat Command in Unix
10. Diff Command in Unix
11. Wc Command in Unix
12. Chmod Command in Unix
13. Gzip Command in Unix
14. Gzcat Command in Unix
15. Gunzip Command in Unix
16. Directories Command in Unix

Prev     Next



Like it? Please Spread the word!