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 difference between cmp and diff commands

2 Answers   Amazon, CTS,


What is @echo off?

0 Answers  


There are three departments A,B and C.Write a query to display the names of all the persons( in departments other than A) who are paid higher than the person receiving the lowest salary in DEPT A

1 Answers   Wipro,


How do you rename the files(*.sh) with file names containing space in it?for example "interview question.sh" needs to rename to "interview-question.sh". Appreciate your inputs.Thanks.

5 Answers   Wells Fargo,


Explain about sourcing commands?

0 Answers  






What is $1 in shell scripting?

0 Answers  


What is in a script?

0 Answers  


When should shell programming/scripting not be used?

0 Answers  


What is .sh file in mac?

0 Answers  


How do I start a shell script?

0 Answers  


What is the lifespan of a variable inside a shell script?

0 Answers  


Is shell scripting easy to learn?

0 Answers  


Categories