Francais | Espanol | Deutsche | Italiano | 中文 | 한국어 | 日本語 |

This blog is owned by
Amey Palyekar
software engineer by profession


Add to Technorati Favorites
~My Links~



October 2006
April 2007


Computer Blogs -  Blog Catalog Blog Directory


Linux Commands References - II

Apr 9, 2007
File Utilities

cmp - compares two files
cmp file1 folder1/file2
no command output means file are identical
also compares the punctuation marks
reports only the fist difference found within the files.

diff -
diff path/file1 path2/file2
reports detail differences between two files
no command output means files are identical
sample output legends:
1c2 - line 1 from file1 changed to line 2 in file2
0a1 - add line 1 from file2 to line 0 (top of line 1) in file1
5d5- delete line 1 from file1 to gt line 5 from file2
diff command can tell which file is more complete by showing new lines within that file.
diff command is case sensitive by default
diff -i file1 file2 : disables case sensitivity.
diff -b file1 file2: ignores spaces, blanks and tabs while comparing

rm path/file1
removes a file

compress filename1
Command to compress the large files
the one that are not used often are good selection for compression
when compressed '.z' extension is added to file.
once compressed you can't access file by its old name.
The ownership modes of original file are preserved when file is compressed
can compress more than one file at a time
e.g: compress file1 file2
compress -v *w*
the above command gives the verbose information of all the files that has 'w' in their name, about how much file is compressed.
this command may not compress some files , if file is too small or contains encrypted data.
Compression algorithm uses like pattern in files as basis for compression
compress -v -f file1
the above switch -f can be used to force compress the file1
force compression using -f can sometimes increase the size of the file after compression.

uncompress compfile.z
to uncompress the compressed file
using extension in command is optional
The wildcard * is useful to uncompress all files in directory
e.g: uncompress dir/*.z
uncompress -c filename1
above command writes the compressed or uncompressed files to standard output, but file isn't altered and remain compressed.
this can also be done using zcat command
e.g: zcat filename1.z
but zcat needs '.z' extension to be specified explicitly.

some files are written in binary code to send such file by mails, you have to encode it first
this can be done using following command
uuencode file1 - encodes executable file file1
uudecode file2 - decode file file2 that is encoded



At 10:04 AM , Anonymous Anonymous said...

Thank you for the auspicious writeup. It in fact used to

be a entertainment account it. Glance complicated to

more introduced agreeable from you! However, how could we communicate?
Also see my web site -


Post a Comment

Subscribe to Post Comments [Atom]

<< Home