Thursday, October 17, 2013

BASIC UNIX FOR DBA'S

Unix is operating system is come in 1969 at AT&T bell labs by Ken Thompson and Dennis Ritchie.
KERNAL- It is heart of OS. is intract with H/W. also most of work like task management ,memory management  etc.
SHELL- It is utility to process request .is tell the what to do to OS.C shell, Bourne Shell,Krone Shell.

$ls -l
total 1962188

drwxrwxr-x  2 amrood amrood      4096 Dec 25 09:59 uml
-rw-rw-r--  1 amrood amrood      5341 Dec 25 08:38 uml.jpg
drwxr-xr-x  2 amrood amrood      4096 Feb 15  2006 univ
drwxr-xr-x  2 root   root        4096 Dec  9  2007 urlspedia
-rw-r--r--  1 root   root      276480 Dec  9  2007 urlspedia.tar
drwxr-xr-x  8 root   root        4096 Nov 25  2007 usr
drwxr-xr-x  2    200    300      4096 Nov 25  2007 webthumb-1.01
-rwxr-xr-x  1 root   root        3192 Nov 25  2007 webthumb.php
-rw-rw-r--  1 amrood amrood     20480 Nov 25  2007 webthumb.tar
-rw-rw-r--  1 amrood amrood      5654 Aug  9  2007 yourfile.mid
-rw-rw-r--  1 amrood amrood    166255 Aug  9  2007 yourfile.swf
drwxr-xr-x 11 amrood amrood      4096 May 29  2007 zlib-1.2.3
$
Here is the information about all the listed columns:
  1. First Column: represents file type and permission given on the file. Below is the description of all type of files.
  2. Second Column: represents the number of memory blocks taken by the file or directory.
  3. Third Column: represents owner of the file. This is the Unix user who created this file.
  4. Fourth Column: represents group of the owner. Every Unix user would have an associated group.
  5. Fifth Column: represents file size in bytes.
  6. Sixth Column: represents date and time when this file was created or modified last time.
  7. Seventh Column: represents file or directory name.
In the ls -l listing example, every file line began with a d, -, or l. These characters indicate the type of file that's listed.
PrefixDescription
-Regular file, such as an ASCII text file, binary executable, or hard link.
bBlock special file. Block input/output device file such as a physical hard drive.
cCharacter special file. Raw input/output device file such as a physical hard drive
dDirectory file that contains a listing of other files and directories.
lSymbolic link file. Links on any regular file.
pNamed pipe. A mechanism for interprocess communications
sSocket used for interprocess communication.
###################################################################3

COPY FILES 
                         cp source  destination

     exp: cp /oracle/anurag/test.txt    /oracle/

##############################################################

Move file to one location to another location
(cut & paste)

mv /oracle/test.txt    /iptv/rest/

#################################################################
Delete 

rm test.txt

rm test1.txt test2.txt test3.txt
rm -rf anurag.txt  (its remove the file without asking )

##################################################################

mkdir /test

mkdir -p  /test/test1/test2/test3/
(is create  parent and sub folder)

rmdir /anurag
(but directory should be empty)
#######################################################3

File Permission


-rwxr-xr--
 r :   read-4
w :  write (modify)-2
e  :  execute-1
-  :  no permission-0

rwx wrx xw-

first 3 -owner
second 3 - group
third 3 - others

######################################
Directory permission

chmod

To set/modify a file's permissions you need to use the chmod program. Of course, only the owner of a file may use chmod to alter a file's permissions. chmod has the following syntax:chmod [options] mode file(s)
The 'mode' part specifies the new permissions for the file(s) that follow as arguments. A mode specifies which user's permissions should be changed, and afterwards which access types should be changed. Let's say for example:chmod a-x socktest.plThis means that the execute bit should be cleared (-) for all users. (owner, group and the rest of the world) The permissions start with a letter specifying what users should be affected by the change, this might be any of the following:
  • u the owner user
  • g the owner group
  • o others (neither u, nor g)
  • a all users
This is followed by a change instruction which consists of a +(set bit) or -(clear bit) and the letter corresponding to the bit that should be changed.


chmod 777 /oracle/test.txt

-rwxwrxxwr



#########################################################################

Compress folder using tar command 

tar -cvf   /db/test.tar /test

if folder size greater then 8GB the use 

tar -cvEf /db/test.tar  /test

No comments:

Post a Comment