–reference, stat, file, diff, comp, cmp, md5sum
–reference
=======
$chmod –reference file1 file2
$chgrp –reference file1 file2
$chown  –reference file1 file2
stat command – to find out about the extended attributes of a file
=========
$cd $ORACLE_HOME/bin
$stat oracle                # shows size and access/modify/change dates for a file
$stat -f oracle             # shows info on the file system
$stat -t oracle              # shows filesystem info but on one line
“relink utilities” will relink all oracle utilities, saving old version with an “O” at the end of the filename.
file command – to find out about the type of file
========
$file a.a                      # tells you what the file type is
e.g.
file a.log
 a.log: ASCII text
file a.Z
 a.Z: compress’d data 16 bits
file -z a.Z
 a.Z: ASCII text (compress’d data 16 bits)
file spfile+ASM.ora.ORIGINAL
 spfile+ASM.ora.ORIGINAL: symbolic link to
 /u01/app/oracle/admin/DBA102/pfile/spfile+ASM.ora.ORIGINAL
file -L spfile+ASM.ora.ORIGINAL
 spfile+ASM.ora.ORIGINAL: data
This file checks the ASCII files, even if they are compressed, and lists them in chronological order
$file -Lz * | grep ASCII | cut -d”:” -f1 | xargs ls -ltr
diff – to see the differences between files
==
diff file1 file2Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # the output (like 1d0) is what must be done in sed to make the files the same.
diff -y file1 file2 -W 120Â Â Â Â Â Â Â # -y for side by side, W 120 for use 120 char wide screen
diff -q file1 files                   # just to see if the files differ but don’t actually show the differences
diff -u file1 file2Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # gives output in a formated version
diff dir1 dir2Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # diff can be used on directories
diff -r dir1 dir2Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # diff can be used on directories, -r to go down directories
diff -r dir1 dir2 | grep -v Common
cmp – to compare two files
===
cmp -s file1 file2; echo $?    # output 0=same, 1=different
cmp sqlplus sqlplusO
 sqlplus sqlplusO differ: byte 657, line 7  # even though the files are the same size
comm – to see whats common between two files in 3 columns
====
comm file1 file2
comm -1 file1 file2Â Â Â Â Â Â Â Â Â Â Â Â Â Â # supresses the info in file 1 only
md5sum
=====
md5sum file1
md5sum file1 file2 > f1f2
md5sum –check f1f2Â Â Â Â Â Â Â Â Â # checks that file1 and file2 haven’t been changed (against the sum generated in the previos command)
Discussion ¬