unix vr1 01

45
Introduction to UNIX The UNIX Operating System Copyright Zensar Technologies, 2007. All rights reserved. List the functions of an OS List the types of Operating Systems available List the features of UNIX that make it useful as an OS in a multi-user system Understand the basic concepts of a multi-user system List the components of the UNIX system List the features of the shell

Upload: kumar-gautam

Post on 16-Dec-2015

236 views

Category:

Documents


2 download

DESCRIPTION

unix doc presentation

TRANSCRIPT

Introduction to UNIXList the functions of an OS
List the types of Operating Systems available
List the features of UNIX that make it useful as an OS in a multi-user system
Understand the basic concepts of a multi-user system
List the components of the UNIX system
List the features of the shell
Introduction to UNIX
Objectives (contd.)‏
List the various types of files in UNIX
List the types of users in UNIX
Login and logout from a UNIX session
Understand the role of the shell as a command interpreter
List the types of shells
Introduction to UNIX
Objectives (contd.)‏
pwd
cd
mkdir
rmdir
ls
Objectives (contd.)‏
cat
cp
rm
mv
date
Objectives (contd.)‏
Display the manual pages using man
Set the File Access Permissions for files using the chmod command
Use the vi editor in UNIX to create and edit files
Introduction to UNIX
An Operating System
Software program designed to act as an interface between a user and a computer
Performs the following functions:
Single-user
Multi-user
Multi-user System
Communication Lines
Introduction to UNIX
Features of a Multi-user System
Multi-programming
Time-sharing
Multi-tasking
Features and Benefits of UNIX
Portability
Machine-independence
Components of UNIX
Shell
Acts as an interface between the user and the kernel
Is executed as soon as the user logs in
Can be of the following types:
Bourne Shell
C Shell
Korn Shell
Restricted Shell
Features of the Shell
UNIX File System
Consists of the following directories under the root directory:
/bin
/dev
/etc
/usr
/user
/lib
/tmp
Each user is given a HOME directory under the user directory
Introduction to UNIX
File-naming Conventions
Can be upto 14 characters long
Can contain digits, a dot (.) or the hyphen (-) or the underscore symbol (_) anywhere
Can contain both upper-case and lower-case alphabets
Are case-sensitive
Example:
Introduction to UNIX
Directory Typical Contents
/ - The "root" directory
/usr/bin - Higher-level system utilities and application programs
/sbin - Superuser system utilities (for performing system administration tasks)
/lib - Program libraries (collections of system calls that can be included in programs by a compiler) for low-level system utilities
/usr/lib - Program libraries for higher-level user programs
Introduction to UNIX
Directory Typical Contents
Tmp - Temporary file storage space (can be used by any user)
/home( or /homes) - User home directories containing personal file space for each user. Each directory is named after the login of the user.
/etc - UNIX system configuration and information files
/dev - Hardware devices
/proc - A pseudo-filesystem which is used as an interface to the kernel. Includes a sub-directory for each active program (or process).
Introduction to UNIX
Types of Files in UNIX
Ordinary files
Directory files
Special files
Types of Users in UNIX
System Administrator
File Owner
Group Owner
Other Users
Working with UNIX
Shell as a Command Interpreter
Shell prints
shell waits command
Directory Commands
pwd Command
$ pwd <Enter>
$
/usr/bin is the directory in which the user is currently working
Introduction to UNIX
cd Command
$ cd /user <Enter>
$
The full path-name of the directory which the user wants to make current is specified
.. can be used to change to a parent directory
Introduction to UNIX
cd Command (contd.)‏
Introduction to UNIX
mkdir Command
Creates subdirectories
The current directory does not change to the new directory
Full path-names can be specified when creating a directory
Introduction to UNIX
rmdir Command
be empty
Introduction to UNIX
ls Command
$ ls /user/gomes <Enter>
Names are printed in sorted order
The directory name is optional if the names of files and directories under the current directory are to be listed
Introduction to UNIX
ls -l Command
$ ls -l /user/gomes <Enter>
total 3
-r w -r - -r - - 1 gomes student 13 Jan 1 10:39 data1
-rwxrwxrw x 1 gomes student 19 Feb 10 21:35 data2
drwxrwxr - - 2 gomes student 32 Jan 16 16:50 prog-files
$
-l is referred to as an option of the ls command
Introduction to UNIX
cat Command
$ cat data1 <Enter>
A sample file
$
Full path-names can also be specified to display a file in another directory
The cat command can also display more than one file
$ cat data1 data2 <Enter>
$
cp Command
Duplicates files
$ cp data1 data3 <Enter>
If the target file already exists, its contents will be overwritten by the contents of the source file
Files can be copied to and from another subdirectory
Introduction to UNIX
rm Command
Removes files
mv Command
Changes the name of a file or directory/moves files from one directory to another
Example: Renaming a file
$ mv data3 newfile <Enter>
Example: Renaming a directory
$ mv /user/gomes/prog-files /user/gomes/programs <Enter>
In UNIX, a file can also be moved to another directory (not copied)‏
$ mv data3 /user/gomes/programs/data3 <Enter>
Other Commands
date Command
$ date <Enter>
$
tput clear Command
Clears the screen and positions the cursor on the top left corner of the screen
Introduction to UNIX
who Command
$ who <Enter>
gomes tty02 Feb 2 10:30
dolly ttyi3 Feb 2 9:40
anita tty01 Feb 2 9:00
paula tty07 Feb 2 9:00
The who command with am i can be used to display the name of current user
$ who am i <Enter>
$
Wildcard Matching
Offers the facility to perform an operation on a set of files
The wildcard characters are:
?
Introduction to UNIX
Displaying Manual Pages
The man command displays pages from the UNIX reference maunal
The manual pages are organized as follows:
Synopsis
Description
Example
Files
File Access Permissions (FAP)‏
File Owner
Group Owner
Other Users
Read access
Write access
Execute access
Changing FAP
Invoke the chmod command
Indicate for which user the permission is to be changed
users are denoted by u, g or o
Indicate which permission is to be changed
permissions are denoted by r, w or x
Indicate whether the permission is to be given or removed
use + or -
Indicate the file for which permissions are to be changed
Introduction to UNIX
chmod Command
$ chmod ug+wx <filename> <Enter>
File Owner and Group Owner are granted write and execute permissions for the specified filename
$ chmod g-w <filename> <Enter>
The write permission is revoked from Group Owner for the specified filname
Introduction to UNIX
vi Editor
Used to enter and edit text files containing data or documents or programs
Displays the contents of files on the screen
Allows the user to add, insert, delete or change parts of the text
Introduction to UNIX
Commands of vi
h Move to previous character
l Move to next character
k Move up one line
j Move down one line
x Delete character at current cursor position
dd Delete line
:q! Quit without saving changes
Introduction to UNIX
Summary
An Operating System (OS) forms an interface between users and the hardware and performs functions of Command Interpretation, Peripheral, Memory and Process Management.
Operating Systems are of two types: single-user and multi-user. Multi-user OS handles multiple users as well as multiple devices simultaneously. Such an Operating System is more efficient and more sophisticated than a single-user OS.
Multi-user systems allow many users to share the computing power of a computer. This kind of system consists of a central unit, a console and a number of terminals attached to the central unit. These terminals may be dumb or smart.
Introduction to UNIX
Summary (contd.)‏
UNIX is a multi-user OS and has a number of features that make it ideal as a multi-user OS. UNIX is a multi-programming, time-sharing and multi-tasking system. The three components of UNIX are Kernel, Utilities and Application programs.
The shell is a utility program that comes with the system. The shell forms an interface between the user and the kernel and acts as the command interpreter for the kernel.
For organizing data on the disk, UNIX provides a file system which allows you to group files in a convenient manner. The UNIX file system has a hierarchical structure where the files can be stored under directories.
Introduction to UNIX
Summary (contd.)‏
UNIX commands are entered at the prompt. The directory and file commands in UNIX can be summarized as follows:
Command Function
cat Display the contents of files
cp Copy one file to another
rm Remove files
Introduction to UNIX
Summary (contd.)‏
Command Function
mv Change the name of a file/directory or move files from one directory to another
date Display system date
tput clear Clear screen