<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Diff_untuk_membandingkan_file_atau_folder</id>
	<title>Diff untuk membandingkan file atau folder - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Diff_untuk_membandingkan_file_atau_folder"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Diff_untuk_membandingkan_file_atau_folder&amp;action=history"/>
	<updated>2026-04-19T18:06:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=Diff_untuk_membandingkan_file_atau_folder&amp;diff=34920&amp;oldid=prev</id>
		<title>Onnowpurbo: New page: Compare Directories using Diff in Linux  To compare 2 files, we use the diff command. How do we compare 2 directories? Specifically, we want to know what files/subdirectories are common, w...</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Diff_untuk_membandingkan_file_atau_folder&amp;diff=34920&amp;oldid=prev"/>
		<updated>2012-11-20T11:57:32Z</updated>

		<summary type="html">&lt;p&gt;New page: Compare Directories using Diff in Linux  To compare 2 files, we use the diff command. How do we compare 2 directories? Specifically, we want to know what files/subdirectories are common, w...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Compare Directories using Diff in Linux&lt;br /&gt;
&lt;br /&gt;
To compare 2 files, we use the diff command. How do we compare 2 directories? Specifically, we want to know what files/subdirectories are common, what are only in 1 directory but not the other.&lt;br /&gt;
&lt;br /&gt;
Unix old-timers may remember the dircmp command. Alas, that command is not available in Linux. In Linux, we use the same diff command to compare directories as well as files.&lt;br /&gt;
&lt;br /&gt;
 $ diff  ~peter ~george&lt;br /&gt;
 Only in /home/peter: announce.doc&lt;br /&gt;
 diff /home/peter/.bashrc /home/george/.bashrc&lt;br /&gt;
 76,83d72&lt;br /&gt;
 &amp;lt;&lt;br /&gt;
 &amp;lt; # Customization by Peter&lt;br /&gt;
 &amp;lt; export LESS=-m&lt;br /&gt;
 &amp;lt; export GREP_OPTIONS=&amp;#039;--color=always&amp;#039;&lt;br /&gt;
 &amp;lt; shopt -s histappend&lt;br /&gt;
 &amp;lt; shopt -s cmdhist&lt;br /&gt;
 &amp;lt; export PROMPT_COMMAND=&amp;quot;history -a;$PROMPT_COMMAND&amp;quot;&lt;br /&gt;
 &amp;lt; #echo keycode 58 = Escape |loadkeys -&lt;br /&gt;
 Only in /home/george: .mcoprc&lt;br /&gt;
 Only in /home/peter: .metacity&lt;br /&gt;
 Only in /home/george: .newsticker-images&lt;br /&gt;
 Only in /home/peter: .notifier.conf&lt;br /&gt;
 Only in /home/george: targets.txt&lt;br /&gt;
 Only in /home/peter: .xsession-errors &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Without any option, diffing 2 directories will tell you which files only exist in 1 directory and not the other, and which are common files. Files that are common in both directories (e.g., .bashrc in the above listing) are diffed to see if and how the file contents differ.&lt;br /&gt;
&lt;br /&gt;
If you are NOT interested in file differences, just add the -q (or --brief) option.&lt;br /&gt;
&lt;br /&gt;
 diff -q ~peter ~george  |sort&lt;br /&gt;
 Files /home/peter/.bashrc and /home/george/.bashrc differ&lt;br /&gt;
 Only in /home/george: .mcoprc&lt;br /&gt;
 Only in /home/george: .newsticker-images&lt;br /&gt;
 Only in /home/george: targets.txt&lt;br /&gt;
 Only in /home/peter: .metacity&lt;br /&gt;
 Only in /home/peter: .notifier.conf&lt;br /&gt;
 Only in /home/peter: .xsession-errors&lt;br /&gt;
 Only in /home/peter: announce.doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
diff orders its output alphabetically by file/subdirectory name. I prefer to group them by whether they are common, and whether they only exist&lt;br /&gt;
in the first or second directory. That is why I piped the output of diff through sort in the above command.&lt;br /&gt;
&lt;br /&gt;
Note that by default diff does not reach into the subdirectories to compare the files and subdirectories at that level. To change its behavior to recursively go down subdirectories, add -r.&lt;br /&gt;
&lt;br /&gt;
 diff -qr ~peter ~george  |sort&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Referensi==&lt;br /&gt;
&lt;br /&gt;
* http://linuxcommando.blogspot.com/2008/05/compare-directories-using-diff-in-linux.html&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>