Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the difference between commmands cmp and diff?

Answers were Sorted based on User's Feedback



what is the difference between commmands cmp and diff?..

Answer / suitable

The cmp command compares two files of any type and writes
the results to the standard output. By default, cmp is
silent if the files are the same; if they differ, the byte
and line number at which the first difference occurred is
reported.

diff command find differences between two files

Is This Answer Correct ?    56 Yes 11 No

what is the difference between commmands cmp and diff?..

Answer / rajesh kumar (cap)

The cmp command compares only first diffrence between two
file,but in case of diff will cmpare hole file diffrence.

Is This Answer Correct ?    39 Yes 7 No

what is the difference between commmands cmp and diff?..

Answer / william

cmp compares byte by byte; diff compares line by line.

Is This Answer Correct ?    36 Yes 7 No

what is the difference between commmands cmp and diff?..

Answer / deepa rajendran

The cmp command compares two files, and (without options)
reports the location of the first
difference between them. It can deal with both binary and
ASCII file comparisons. It does a
byte-by-byte comparison.

But in diff compares two files, directories, etc, and
reports all differences between the two. It
deals only with ASCII files. It’s output format is designed
to report the changes necessary to convert
the first file into the second.

Is This Answer Correct ?    15 Yes 3 No

what is the difference between commmands cmp and diff?..

Answer / s.sunny

cmp compares the files byte by byte and in first occurence
it shows if any unmatch character will found in error which
contains char no./column no. and line no.

diff is command which tells how to make the files identical.
the o/p is very confussing way. easy way that diff compares
files line by line.
Example:
test1: test2:
1.test! 1.test!
2.a common line. 2.a almost common line.
3.really common line. 3.really common line.
4.one more common line. 4.really not common line.
5.only here. 5.one further line.
6.one more common line.
o/p:
2c2
< A common line.
---
> A almost common line.
3a4,5
> Really not common line.
> One further line.
5d6
< Only here.
imp:
first file (<)
second file (>)
dashed line (-)--> separate o/p from two files.
imp:
c : replace line
d : delete line
a : add line
imp:
1. line 2 differ both files.(which present symbol 'c')
2. line 4 & 5 of 2nd file add in 1st file after 3 line.
(which present symbol 'a')
3. line 5 of file 1 no need to exchange with file 2 for
making 2 files identical, so we delete line 5 from file 1.
(5d6--> line 5 delete from file 1 and that 6 no. shows that
total line 6 in both files means ending line no.)

that's it friends. read carefully....understand each and
every line...u can easily find the meaning of diff and
working...
take care.........

Is This Answer Correct ?    12 Yes 4 No

what is the difference between commmands cmp and diff?..

Answer / sai kiran

cmp---give the first instance of differnce and place like
line and char number in that line

diff--gives the complete differences in the file with the text

> means which has in second file not in first file
< means which has in first file not in second file

Is This Answer Correct ?    11 Yes 5 No

what is the difference between commmands cmp and diff?..

Answer / bandi sreekanth

CMP:is used to compare two files by byte by byte process

DIFF:is used to compare files by line by line and list the defference between two files to standard output.

Is This Answer Correct ?    6 Yes 1 No

what is the difference between commmands cmp and diff?..

Answer / pokhy

Diff displays all the common as well as uncommon,files,directories

Is This Answer Correct ?    1 Yes 0 No

what is the difference between commmands cmp and diff?..

Answer / yuvaevergreen

cmp - compare files and report first line difference
diff - complete difference between two files

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Unix Commands Interview Questions

What does the command ' $who | sort –logfile > newfile' do?

0 Answers  


How to convert a hidden file to normal visible file?

8 Answers  


what is the difference between SED and GREP ? Which one is more better and why?

4 Answers   IBM,


How do I search a whole word in vim?

0 Answers  


Why is shebang used?

0 Answers  


What is grep in bash?

0 Answers  


What is the general format of unix command syntax?

2 Answers  


to list a particular line in the file

5 Answers  


can we use cat command as an editor ..???

12 Answers   TCS,


How do you find which version and name of unix you are using at the command prompt?

7 Answers  


what is the significance of "su" command?

3 Answers  


How would you change all occurrences of a value using VI?

4 Answers  


Categories