what is the difference between cmp and diff commands

Answers were Sorted based on User's Feedback



what is the difference between cmp and diff commands..

Answer / supreetha

cmp--> shows the first difference in the files

diff--> shows all the differences in the files

Is This Answer Correct ?    17 Yes 4 No

what is the difference between cmp and diff commands..

Answer / srikanth

cmp - It will compare files byte by byte
Ex: cmp text text1
text text1 differ: byte 2, line 1

diff - It will compare files line by line
If there are any differences in the file. Then it will print
to stdout along with all lines

Is This Answer Correct ?    13 Yes 0 No

Post New Answer

More Shell Script Interview Questions

What is the use of "test" command?

2 Answers  


What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?

0 Answers  


Why is the use of shell script?

0 Answers  


Create a bash shell script that removes all files whose names end with a "~" from your home directory and subdirectories. Name this script "cleanup.sh"

6 Answers  


how do you write sql queries using shell script for eg:- we have databae table like EMPNO,ENAME,SAL,DEPTNO columns in EMP table how you display EMPNO,SAL FIELDS from emp in SHELL SCRIPT please explain with an example

4 Answers  


What is the difference between a variable and value?

7 Answers   Sun Microsystems,


Please anyone suggest atleast 2 good training institutes in Hyderabad, INDIA where i can learn unix shell scripting.

1 Answers  


Create a bash shell script to sort and then uniq the file from the command line & store it to a new file and output the results to the screen. Name this script "sortAndUniq.sh"

5 Answers  


What are the Different types of shells?

5 Answers  


Write a script to print the first 10 elements of fibonacci series.

0 Answers  


What are the different types of shell scripting?

0 Answers  


write a non recursive shell script that accepts any number of arguments and prints them in the reverse order

3 Answers  


Categories