meld – cvs diff with ease

2012-10-17 1 min read Fedora
Visualization of the "history tree" ...
Visualization of the “history tree” of a revision controlled project, showing branching, merging, tagging, etc. (Photo credit: Wikipedia)

There are couple of ways to make life easier with CVS diff. But here is one that is really good.
First if you haven’t, install meld:

sudo yum install meld

meld is basically a diff viewer and pretty good at it 😉

Continue reading

Compare files excluding certain lines.

2011-10-18 1 min read Bash Fedora Learning Linux

Quick tip, you can use any expression for the sed commands in the (). With this trick you can redirect the stdout of 2 commands to the diff command. This might become very useful, if you want to compare 2 files, excluding the first  line.

diff <(sed '1d' file) <(sed '1d' file2)

More interesting example is where the string ABC is converted to abc before comparing in the second file with the following command:

Continue reading

Find out why a program can't seem to access to a file

2010-05-05 2 min read Fedora Linux

$ strace php tias.php -e open,access 2>&1 | <a class="zem_slink freebase/en/grep" href="http://en.wikipedia.org/wiki/Grep" title="Grep" rel="wikipedia">grep foo.txt Sometimes a program refuses to read a file and you&#8217;re not sure why. You may have display_errors turned off for <a class="zem_slink freebase/en/php" href="http://www.php.net/" title="PHP" rel="homepage">PHP or something. In this example, fopen(&#8217;/var/www/test/foo.txt&#8217;) was called but doesn&#8217;t have read access to foo.txt.

Strace can tell you what went wrong. E.g., if php doesn&#8217;t have read access to the file, strace will say &#8221;EACCESS (Permission denied)&#8221;. Or, if the <a class="zem_slink freebase/guid/9202a8c04000641f8000000000220ffa" href="http://en.wikipedia.org/wiki/Path_%28computing%29" title="Path (computing)" rel="wikipedia">file path you gave doesn&#8217;t exist, strace will say &#8221;ENOENT (No such file or directory)&#8221;, etc.

Continue reading

Diff Linux command — Find the difference in files the easier way.

2009-09-17 2 min read Linux

In Linux you can use diff command to find the differences in file.

What is interesting is that you can use &#8221;diff -u&#8221; to list the differences with &#8217;+&#8217; and &#8217;-&#8217; rather than sometimes confusing &#8217;>&#8217; and '<&#8217;.

Running the regular diff between two text files to see the differences is not so elegant for the human eye to decode. Luckily there are plenty of tools out there to make this easy.

Continue reading