GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Operating System  >  Unix Commands
Go To First  |  Previous Question  |  Next Question 
 Unix Commands  |  Question 22 of 73    Print  
What difference between cmp and diff commands?
cmp - Compares two files byte by byte and displays the first mismatch
diff - tells the changes to be made to make the files identical



  
Total Answers and Comments: 2 Last Update: May 07, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 30, 2006 01:53:34   #1  
parinita        

RE: What difference between cmp and diff commands...

cmp <filename1> <filename2> gives the 1st byteno and lineno of file1 which is to be changed to make filename1 identical to filename2.

diff gives the text of  filename2 which is different from filename1.

we can use directory name in diff, but not in cmp


 
Is this answer useful? Yes | No
May 07, 2008 01:13:39   #2  
wow_suraj Member Since: May 2008   Contribution: 15    

RE: What difference between cmp and diff commands?
'cmp' and 'diff' both command are used to list the differences, the difference between both the command is that 'cmp' is used to find the difference between files whereas 'diff' is used to find the difference between directories.

cmp will list the line and column number that are different between two files.

diff will list the different files and sub-directories present between two directories.

 
Is this answer useful? Yes | No

 Related Questions

A pipe is two or more commands separated by pipe char '|'. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command. Example : ls 
Latest Answer : The Unix commands alone are powerful, but when two or more commands get combine together, we can accomplish complex task with ease.In unix we can combine the two or more commands together to perform multiple action simulatenously with the help of Pipe ...

Cat displays file contents. If the file is large the contents scroll off the screen before we view it. So command 'more' is like a pager which displays the contents page by page. 
Latest Answer : The cut command cuts bytes, characters, or fields from each line of a file and writes these bytes, characters, or fields to standard output. If you do not specify the File parameter, the cut command reads standard input.The more command reads files and ...

cmp - Compares two files byte by byte and displays the first mismatchdiff - tells the changes to be made to make the files identical  
Latest Answer : 'cmp' and 'diff' both command are used to list the differences, the difference between both the command is that 'cmp' is used to find the difference between files whereas 'diff' is used to find the difference between directories.cmp ...

is the output redirection operator when used it overwrites while >> operator appends into the file. 
Latest Answer : ">" operator redirects the output to a file, if the file already existst and contains some data in it, the ">" would cause the data over written with new data.">>" Redirects the output to be appened to the end ...

How is the command “$cat file2 “ different from “$cat >file2
Both the commands mean the same , the file file1 is read and its contents are copied to file2 

Ans:  manA filter is a program which can receive a flow of  data from std input, process (or filter) it and send the result to the std output. 
Latest Answer : man and cat ...

What does the command “ $who | sort ‚logfile > newfile‚do?
The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as std input.In the above 

$ ls > file1$ banner hi-fi > message$ cat par.3 par.4 par.5 >> report$ cat file1>file1$ date ; who$ date ; who > logfile$ (date ; who) > logfile 
Latest Answer : $ ls > file1=====>Redirects the output of ls command to file1$ banner hi-fi > message=====>Redirects the output of banner command to message$ cat par.3 par.4 par.5 >> report=====>Redirects the output of files to report and the o/p ...

Latest Answer : both are same. daemons are the background processes in unix. similarly background processes in windows are called as service agents or service processes. ...

Latest Answer : In Hardlink Inode is same and both are independentIn Softlink Inode is diff and the linked file will b a shortcut of first file ...
Read Answers (7) | Asked by : Shankar


 Sponsored Links

 
Related Articles

How to call C header that is not provided generally by system in C++?

Headers can be called by using extern C Syntax of extern C is: extern &quot;C&quot; &lt;function declaration&gt; for example to call C functions from C++ we can write extern &quot;C&quot; { &lt;function declaration&gt; &lt;function declaration&gt; ...
 

What is difference between call by value and call by reference in function?

The arguments passed to function can be of two types 1. Values passed 2. Address passed The first type refers to call by value and the second type refers to call by reference. For instance consider program1 main() { int x=50, y=70; interchange(x,y); printf(&ldquo;x=%d y=%d&rdquo;,x,
 

SQL Table Commands

SQL Table Commands Overview As mentioned previously in this series of SQL articles, databases are primarily composed of tables. The &ldquo;columns and rows&rdquo; structure of the table allows data to be efficiently inserted, manipulated, updated, and deleted from the database. The three mos
 

System Implementation

In the previous articles relating to SDLC Stages we&nbsp;discussed about Project Planning and Feasibility Study moved on to System Analysis and Requirements which lead to Systems Design. Systems Design will naturally lead to another stage where it becomes closer to the actual deployment of the p
 

System Analysis and Requirements

In the previous chapter, we&rsquo;ve discussed about project planning and feasibility study. That stage was important because it tries to establish a problem in our highly technological world. As our understanding on what we can do in computers evolve and so are the things that we need to make t
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

Operating Systems and IT Certification

With the burst of information technology that is becoming a part of the dominant culture throughout the world, are programs that are designed to help those in this area to grow in knowledge.&nbsp; By understanding the different technologies that are available, one is able to use them and impleme
 

Unix Client Server Technology

Unix Client Server Technology Understanding the Role of Unix When discussing client server technology it is important to understand UNIX one of the first primary building blocks for network possibilities that continues its influence today UNIX is an operating system designed for multi tasking by mul
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape