UNI X TRAINING MODULE
Learning Objectives 01 - Introduction 03 - Intorduction 05 - Performing to UNIX and its to File and Disk Directory Types Systems Partitioning and Formatting 04 - 02 - What is Understanding UNIX System UNIX Commands
INTRODUCTION INTRODUCTI INTRODUCTI INTRODUCTI ON TO UNIX ON TO ON TO UNIX Shell The UNIX Architecture
INTRODUCTION TO • UNIX is a computer Operating System. A user can also run UNIX multiple programs at the same time; hence UNIX is called multitasking. • The basic commands do not vary much between them nevertheless , the basis of the packaged utilities differ. Linux is also a flavor of Unix which is freely available. • It act as a link between the computer and the user. Unix is used for mission-critical databases. While Linux is used for services . • Unix was originated around in 1969 at AT&T Bell Labs by Ken Thompson and Dennis Ritchie, Douglas McIlroy, and Joe Ossanna. Unix became the leading O/S for commercial enterprises during the 1980s and 1990s. • Although IBM Mainframe still performs well for extremely large databases (Multi Terabyte) UNIX is more cost- effective, versatile, powerful and stable for medium to large firms. • Unix can be a viable alternative for eg. Sun Servers with soft partitioning, high-amounts of memory, hot - spare processors and capacity-on-demand features. • The Choice of the particular O/S depends on the requirements like Availability, Reliability and response time • There are various Unix variants available in the market.
• Users communicate with the kernel through a program known as the shell. • The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel. INTRODUCTION TO UNIX SHELL
INTRODUCTION TO THE UNIX ARCHITECTURE • Kernel: The kernel is the heart of the operating system. It interacts with hardware and most of the tasks like memory management, task scheduling, and file management. • Shell: The Shell is a command- line interpreter which translates and passes our commands to the Kernel‘s understanding format. The commands issued by the user are called shell commands and the scripts are called shell scripts.
INTRODUCTION TO THE UNIX ARCHITECTURE • Shell: The shell is the utility that processes our requests. • When we type in a command at our terminal, the shell interprets the command and calls the program that we want. • The shell uses standard syntax for all commands. C Shell, Bourne Shell, Bash Shell and Korn Shell are the most famous shells available with most of the Unix variants.
04 UNIX SYSTEM 05 UNIX MACHINES 06 TYPES OF FILES 07 UNIX COMMANDS 08 DISK PARTITIONING AND FORMATTING
There are several approaches to accessing the Databases : • Directly from the Server Hosting the Databases • Via a UNIX Workstation • Through a Windows NT Server front end • Log directly into the server through the telnet service: • Login to the server through a display framework such as X-Client that emulates the look and feel of a UNIX workstation • Connect through a GUI called OEM
TYPES OF UNIX • Ultrix (DEC - Digital Equipment SYSTEMS Corporation) • BSD unix (Berkeley Software Distribution - FreeBSD, OpenBSD) • SCO unix (SCO Group Inc.) • AIX (IBM - International Business Machines Corporation) • IRIX (SGI - Silicon Graphics Incorporated) • Solaris (Sun - Sun Microsystems) • Mac OS X (Macintosh - Apple Computer, Inc.)
UNIX Machine Identify the UNIX Machine
UNIX MACHINE Pinging the Machines
TYPES OF FILES • Ordinary Files − An ordinary file is a file on the system that contains data, text, or program instructions. • Directories − Directories store both special and ordinary files. For users familiar with Windows or Mac OS, UNIX directories are equivalent to folders. • Special Files − Some special files provide access to hardware such as hard drives, CD-ROM drives, modems, and Ethernet adapters.
FILE CREATION Files can be newly created by three ways : • vi <filename> • cat > <filename> -m concatenation • touch <filename1> <filename> • To append an already existing file cat >> <filename> • mkdir <dirname> • mkdir –p /dir1/dir2/dir3 • mv fn1 fn2 • rm filename / rm –rf <directory name >
LISTING THE FILES
Read – 4 Write - 2 Execute - 1 Owner - 7 Group - 7 Others - 7 $ chmod - R 770 <dir name> $ chmod 770 <filename> $ chown –R oracle:oinstall <dirname>/filename
• A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired. • Our hard drive can have various partitions which usually contains only one file system, such as one file system housing the / file system or another containing the /home file system.
• File system is a service which supports an abstract representation of the secondary storage to the OS • A file system organizes data logically for random access by the OS. • A virtual file system provides the interface between the data representation by the kernel to the user process and the data presentation to the kernel in memory. The file and directory system cache. • Because of the performance disparity between disk and CPU/memory, file system performance is the paramount issue for any OS
• Information about each regular local file is contained in a Regular structure called an INODE. Containing the file FCB information. Files and I- • There is 1-to-1 mapping between the INODE and a file. However a file may have multiple INODES. Large files may in fact multiple layers of INODE’s using indirection to keep track of data blocks. • Each INODE is identified through its number, a non-negative integer as an index into - • The INODE hash array is a list of allocated INODE‘s located at the beginning of the file system • INODE structures (UNIX i-node list) are stored on the file system block device (e.g., disk) in a predefined location on the disk. UNIX: the i-node list. Where it is exactly is file system implementation specific. • INODE numbers have only local meaning (to each file system) • One file system per device, one INODE table per file system. • Hierarchical structure: Some FCBs are just a list of pointers to other FCBs (i.e. indirection) • To work with a file (through the descriptor interface) the I-node of the file is brought into the main memory as an in-core INODE (V-Node).
File System Data Structure
File System in More Detail
Director • Unix uses a hierarchical file system y structure with root (/) at the base of the file system and all other directories spreading structur from there • Examples : • / - root • /bin – executable files are located • /dev – These are device drivers • /etc – Supervisor directory commands • /lib - Shared library files • /home - contains the Home directory for users and other accounts • Copying Files : • $cp file1 file2 • pattern Matching • $ ls –l | grep
Listing the directory contents • First Column: represents file type and permission given on the file. Below is the description of all type of files. • Second Column: represents the number of memory blocks taken by the file or directory. • Third Column: represents owner of the file. This is the Unix user who created this file. • Fourth Column: represents group of the owner. Every Unix user would have an associated group. • Fifth Column: represents file size in bytes. • Sixth Column: represents date and time when this file was created or modified last time. • Seventh Column: represents file or directory name.
Basic Directory Terms • In UNIX, special files (not special device files) called directories contain information about other files. A UNIX • Directories directory is a file whose data is an array or list of (filename, • Moving around the file i-node#) pairs. system • it has an owner, group owner, size, access permissions, etc. • Listing Directory Contents • many file operations can be used on directories • Changing file permissions • As a file, a directory has an I-node type structure. • A flag in the structure indicates its type. and attributes • Moving, renaming and • Unlike other files, the kernel imposes a structure on directory files using mkdir. copying files • Viewing and editing Files • A directory is a sequence of lines , a sequence of directory • Searching for Files entries of variable length where each line contains an i- • Searching for strings in node number and a file name mapping: <filename, inode #> files • Directory data is stored as binary, cannot use cat. But some • File Compression older UNIXs allow: od -c dir-name. • Although directories are files, UNIX permissions – rwx- have slightly different meanings: • - r, lists directoy contents • - w, add a file to the directory • - x, cd to the directory Catalog Organization (Directories)
Subdi rector ies• mkdir subdir causes: -th-•aen“c.”rie-ananotiddoen“.n.o”ufamarebsuerbdainrddniraemcteorayrefialeddanedd an i-node for it to the parent directorsytofirleed as ordinary file names with i-node numbers pointing to the correct directory files.
memory vs. Seconda ry storage
COMMA Important Unix • head – the first N number of lines of a particular NDS Commands file is displayed • head -5 <filename> • t ail - The last N number of lines of a particular file is displayed • tail -5 new.txt • echo - prints the string given • echo Hi • export ORACLE_SID ; echo $ORACLE_SID • link - whatever changes made in file 1 reflects in file 2 also • ln file1 file2 • sort – sorts in ascending or descending order • sort –n filename - sorts in ascending order • sort -r filename - sorts in descending order • grep - pattern matching – the whole line is retrieved • $ grep abhi new2.txt • Abhirami • top – task manager • $ top - lists all processes • logname - currently logged in user • du –h <directory name> - disk used by the directory • df –h - disk free space in GB
UNIX Important Unix • rm -rf <directory name> - force remove COMMA Commands directory NDS • cp -r dir1 dir2 – copies directory 1 to directory 2 after creating new • more file – outputs the contents of file • tar cf new.tar new.txt new1.txt new2.txt – zips all these files into new.tar • ps - shows the active processes • kill -9 pid – kills the corresponding process that can neither be ignored nor be caught • :w – saves the contents of the file • :q! – quit without saving • :wq – saves and quits a file • tar xf new.tar – extracts the files from archive • tar czf new.tar.gz files – applies Gzip compression • tar xzf new.tar.gz – extracts a tar using gzip • tar cjf new.tar.bz2 – creates a tar with bzip2 compression • tar xjf new.tar.bz2 – extracts the tar with bzip2 compression • gzip file – compresses a file and renames it to file.gz • gunzip file.z/file.gz – uncompresses the zipped or gzipped files
UNIX COMMANDS BASIC COMMANDS
UNIX COMMANDS • Exercise 1a • Make another directory inside • ls - lists the contents of the directory the unixstuff directory called • ls -a -lists the hidden files backups • mkdir <name of the diretory> • . - current directory cd . • ls • .. - previous directory cd .. • cd (change directory) • cd .. • The command cd directory • Pathnames : • pwd - present working directory means change the current • / - root folder working directory to 'directory'. • Exercise 1b The current working directory • Use the commands cd, ls and may be thought of as the directory you are in, i.e. your pwd to explore the file system. current position in the file- • (Remember, if you get lost, type system tree. • To change to the directory you cd by itself to return to your have just made, type • % cd unixstuff home-directory) • Type ls to see the contents • ls <name of the directory> - (which should be empty) lists the contents of the current directory . ~ - home directory
Disk Partitioning and Formatting • A partition is a logical grouping of a number of physical cylinders into a logical disk drive. • Each operating system and hardware architecture has it’s own method of partitioning a disk The Commands fdisk -l sda1 - first hard disk ext2 ext3 lvm - grouping of storage devices fdisk /dev/sda1 fdisk /dev/sda2 cat /etc/fstab - automatically mounts lvm lvmdiskscan
Disk Partitioning and Formatting • primary partition - to boot os • secondary parttion - logical drives • lvm is easier to manage mkfs -t ext4 /dev/sdc1 mkdir oracle mount -t ext4 /dev/sdc1 /oracle/ cd oracle umount /oracle mount -t ext4 /opt/oracle1 /oracle1 vi /etc/fstab /dev/sdc1 /opt/oracle1 ext4 defaults man fstab
Disk Partitioning and Formatting
Summary 01 - An Understanding on UNIX Systems and its Origin 02 - Cognizance of 03 - Performing File File and Directory Creation and Subdirectories System 04 - Knowing UNIX 05 - Performing Commands Disk Partitioning and Formatting
Search
Read the Text Version
- 1 - 35
Pages: