Search This Blog

Total Pageviews

Tuesday 30 August 2011

oracle security



http://blog.red-database-security.com/category/oracle-security/

Unix find command on shell script

cat mfind.sh


echo "enter the path:\c"
read path
echo "enter the file name:\c"
read filename
find $path -name $filename -print > x
nl=`wc -l < x`
if [ $nl -eq 0 ]
then
echo File not found
else
cat < x
fi

Unix tar command

tar :Description The "tar" command stands for tape archive.

This command is used to create new archives, list files in existing archives, and extract files from archives.

c - add to archive, using an absolute path
x - extract from archive
t - read the contents of an archive
f - you work with a file, otherwise it's a tape
p - preserve file's permissions and modes
v - verbose, display the result
-I - use an include list
X - use an exclude list





Examples tar cvf /dev/rct0 /home

This command writes a tar archive to the tape device /dev/rct0. It copies the files in the /home directory, and all subdirectories of /home to the tape device.




tar cvf /tmp/home.tar /home

This command creates a tar archive named /tmp/home.tar. The tar command copies the files in the /home directory, and all subdirectories of /home.


tar cvf /tmp/home.tar /home


tar -cvf /users/anuj/b.tar *.sql

tar xvf b.tar -----extract

tar tvf b.tar ----------list the file

tar rvf b.tar *.* appends files at end of archive


Using tar

Using tar to create a file archive on a tape device:

# tar -cvf /dev/rmt0 file.name

or

# tar -cvf /dev/rmt0 .

or for multiple directory hierarchies

# tar -crvf my.tar `find /tmp/junk -type f` `find /var/tmp -type f`

using tar to list the entries in a file archive on a tape device:
# tar -tvf /dev/rmt0

using tar to retrieve a file from a tape device:
# tar -xvf /dev/rmt0 file.name


To list the contents of your archive issue the following command:

tar tf my_arch.tar

To extract the contents of your archive:

tar xvfp my_arch1.tar

Note, that everything will be extracted exactly at the same location from where it was taken. If some directories do no exist then they will be created.


If you want to include into your archive several different directories you might use the following command:

tar cvf my_arch.tar -I include.lst


create an archive file called "sasdir.tar". In this case, the tar command when executed in your home directory will be:

tar -cvf sasdir.tar -C sasdir .
Suppose, you wish to archive the subdirectories "sasdir" and "spssdir" both of which are in your home directory. In this case the tar command executed in your home directory will be:

tar -cvf sasdir.tar -C sasdir . -C ../spssdir .

Oracle DBA

anuj blog Archive