+ All Categories
Home > Documents > Unix.ppt

Unix.ppt

Date post: 13-Dec-2014
Category:
Upload: sammy17
View: 15,792 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
51
Operating Systems The Relationship Between Hardware & Software
Transcript
Page 1: Unix.ppt

Operating Systems

The Relationship Between Hardware & Software

Page 2: Unix.ppt

Goals

Understand what an operating system is Become familiar with several different operating systems Learn about the important features of an operating system,

including file management Understand the Unix Operating System and tools associated

with Unix Understand Unix Permissions

Page 3: Unix.ppt

Why Study Operating Systems?

Understand the relationship between hardware & software

Understand future Operating Systems

Understand powerful tools to help you in your computer use

Page 4: Unix.ppt

What is an Operating System?

Software Controls the relationship

between all other software and hardware

Other Roles

Page 5: Unix.ppt

The Two Major Types of OSs

Letters with symbols, such as C:\>

Type what you want the computer to do - the COMMAND

Type it correctly DOS and UNIX, but they do have

GUIs available

Pictures with descriptive words

Click a picture to start a program

Point and Click Much easier to move the

pointer with the mouse and CLICK on a picture, than to remember COMMANDS

Window 3.1, Windows 95, MAC O/S

Page 6: Unix.ppt

So, What Does an OS Do?

Controls the INPUT, OUTPUT, and PROCESSING activities for the computer

It is the BOSS of what happens in the S/W, the H/W, and between the S/W and H/W

High-quality O/S can make your computer more effective and efficient

Good OS makes the computer easier to use and more efficient

Page 7: Unix.ppt

The Roles of an Operating System

A Traffic Cop A Communication

System A Box of Tools A Self-Starter

Page 8: Unix.ppt

OS as a Traffic Cop

Controls the resources of the computer

Resources include: memory, file storage, and CPU

Multitasking is possible on new computers

Page 9: Unix.ppt

OS as a Communications System

Helps all of the HARDWARE components communicate with each other

Helps the software communicate with the hardware

Page 10: Unix.ppt

OS as Toolbox

Several utility programs included with an O/S

File Management Memory Management Appearance

Management Networking Tools

Page 11: Unix.ppt

OS as a Self-Starter

Takes over just after booting

Checks to see all hardware is present

Mechanisms for Hard Boot & Soft Boot

Page 12: Unix.ppt

Flavors of Operating Systems

Marketed by Microsoft in 1981 Command-Line Inspired by UNIX Used on computers with the Intel Chip

DOS

Page 13: Unix.ppt

Flavors of Operating Systems

Developed by Apple in 1984 Successful Marketing Campaign Changed the ideas about ease of use Largely ignored by the PC world

Apple Macintosh

Page 14: Unix.ppt

The 1984 Macintosh Ad

Premiered during 1984 Superbowl

Played just once Launched a new era of

advertising

Page 15: Unix.ppt

Flavors of Operating Systems

Developed in 1992 First commercially successful GUI for PCs Actually not an Operating System Technically a “shell” that runs on top of DOS

Windows 3.1

Page 16: Unix.ppt

Flavors of Operating Systems

Developed in 1995 Introduced the idea of the “desktop” for PCs Independent Operating System Made networking easier

Windows 95/98/2000

Page 17: Unix.ppt

Flavors of Operating Systems

Developed in 1995 Introduced the idea of the “desktop” for PCs Independent Operating System Made networking easier

Windows 95/98/2000

Page 18: Unix.ppt

Flavors of Operating Systems

Developed by Bell Labs in 1969 Command-Line OS Offered File Sharing Offered Process-Sharing

Unix

Page 19: Unix.ppt

Introducing Unix Commands

Command Line OS Issue commands from a command prompt:phoenix{jstudent}/:phoenix{jstudent}/:

Unix is case sensitive Commands are typed in lowercase:cpcp (copy) is NOT the same as CpCp or CPCP

Page 20: Unix.ppt

Unix Shells

Unix has a number of shells which help the user interact with the Operating System Kernel (the main program that stays resident in memory and executes OS commands)

Shell Examples:– Bourne Shell– Korn– Bash– TCSH– Csh – “C-shell” The default shell for Phoenix

Page 21: Unix.ppt

Command Syntax

Case sensitive! All commands are lowercase General Format:command [switches] parameter1 parameter2command [switches] parameter1 parameter2

Example:ls –l *.htmlls –l *.html

Command

FlagArgument

Page 22: Unix.ppt

Correcting Typographical Errors

DEL key removes the character to the left (in some Telnet clients, BACKSPACE will also do this)

To erase:– C-w – Erases previous word– C-u – Erases an entire line

Page 23: Unix.ppt

Directory Structures

Unix paths begin with a forward slash The initial forward slash (/) represents the root

directory An absolute path begins at the root:/home/jstudent/public_html//home/jstudent/public_html/

A relative path indicates location relative to your present working directory:../images/../images/

Page 24: Unix.ppt

More on Directories

The command pwdpwd will return the directory name in which you are currently working

The directory that represents your personal section of the server is called your home directory

The root directory is parent directory to all other directories (usually restricted use)

Page 25: Unix.ppt

Directory Notation

/ / - represents a directory /. /. – represents the current directory /../.. – represents the parent directory /~ /~ - represents a user’s home directory Creating directories

– No spaces in a name– Use _ or camel casing to name directories– Case sensitive (usually in lowercase, with camel casing)

Page 26: Unix.ppt

Creating a Directory

Use the mkdir command:mkdir campingImagesmkdir campingImages

Command

Required argument: name of the directory (uses camel casing)

Page 27: Unix.ppt

Naming Files

Extensions– Determine the type of the file– Examples

*.txt *.html *.cgi *.gif *.jpg

Filenames that begin with “.” are ‘hidden’ and will not appear unless a special directory command is used.

Page 28: Unix.ppt

File & Directory Permissions

ls –lls –l command will show full details:drwxr-xr-x 2 rmolnar staff 512 Sep 18 2001 funstuff/drwxr-xr-x 2 rmolnar staff 512 Sep 18 2001 funstuff/-rwxr-xr-x 2 rmolnar staff 312 Oct 11 2000 new.html-rwxr-xr-x 2 rmolnar staff 312 Oct 11 2000 new.html

Permissions

Owner

Group

Size

Date

Name

Page 29: Unix.ppt

Unix Permissions

Permission sequence found at the beginning of a directory listing (first 10 characters):

dd rwxrwx r-xr-x r-xr-x

Dir

ecto

ry?

Dir

ecto

ry?

Ow

ner

’s

Ow

ner

’s

Per

mis

sio

ns

Per

mis

sio

ns

Gro

up

’s

Gro

up

’s

Per

mis

sio

ns

Per

mis

sio

ns

Wo

rld

’s

Wo

rld

’s

Per

mis

sio

ns

Per

mis

sio

ns

Page 30: Unix.ppt

Unix Permissions

The first character represents whether the listing is a directory. If it is a directory, a “d” will appear in the first character; otherwise, you should normally see a dash (-).

dd rwxrwx r-xr-x r-xr-x

Page 31: Unix.ppt

Unix Permissions

The remaining nine characters are divided into three triplets, each representing the permissions for the owner, the owner’s group and the world.

-- rwxrwx r-xr-x r-xr-x

Ow

ner

Ow

ner

Ow

ner

Ow

ner

Gro

up

Gro

up

Gro

up

Gro

up

Wo

rld

Wo

rld

Wo

rld

Wo

rld

Page 32: Unix.ppt

Unix Permissions

In each triplet, three permissions can be assigned:– 1st Position: r r stands for Read; grants permission to

view the contents of a file or directory (Value is ‘r’ or ‘-’)– 2nd Position: w w stands for Write; grants permission to

modify a file or the contents of a directory (Value is ‘w’ or ‘-’)

– 3rd Position: xx stands for eXecute; grants permission to run an application or open a directory (Value is ‘x’ or ‘-’)

Page 33: Unix.ppt

Unix Permissions

When changing permissions, we must first decide what number will represent the permissions for a triplet

We can do this by determining whether or not a permission is turned on or off

– If a permission is turned ‘on’ (represented by r, w, or x), it gets a value of 1

– If a permission is turned ‘off’ (represented by a dash), it gets a value of 0

After deciding whether the three permissions in a triplet are on or off, we will have a binary number

We can convert the binary number to its octal equivalent

Page 34: Unix.ppt

Unix Permissions

PermissionsPermissions BinaryBinary OctalOctal

- - -- - - 0 0 00 0 0 00

- - x- - x 0 0 10 0 1 11

- w -- w - 0 1 00 1 0 22

- w x- w x 0 1 10 1 1 33

r - -r - - 1 0 01 0 0 44

r – xr – x 1 0 11 0 1 55

r w -r w - 1 1 01 1 0 66

r w xr w x 1 1 11 1 1 77

Page 35: Unix.ppt

Unix Permissions

Once you’ve established the octal number representing the permission for each triplet, you can then use the change mode (chmodchmod) command to give a directory or file proper permissions

Syntax:chmod permissionMask file/directorychmod permissionMask file/directory

Example:chmod 755 public_htmlchmod 755 public_html

Typically, directories and executable files are given “755” permissions, while other files are given “644” permissions

Page 36: Unix.ppt

Navigating Unix

To move from directory to directory, we use the cdcd command

Syntax:cd path/cd path/

To move from a parent to a child directory:cd child/cd child/

To move from a parent to a grandchild directory: cd child/grandchildcd child/grandchild

G ra ndchild D irectory

Child D irectory

Parent Directory

Page 37: Unix.ppt

Navigating Unix

To move from a child to a parent directory:cd ..cd ..

To move from a grandchild to a parent directory:cd ../..cd ../..

To move to a directory that shares the same parent: cd ../Child 2 cd ../Child 2

G ra ndchild D irectory

Child D irectory

Parent Directory

Child 1 Directory Child 2 Directory

Parent Directory

Page 38: Unix.ppt

The List Command

The list command (lsls) shows the contents of a directory

We can add switches to the list command to modify what the command can do:– ls –lls –l shows files in long format, including permissions (On

Phoenix, you can also use the alias llll)– ls –als –a shows hidden files– ls –cls –c shows file listings in a column format– ls –tls –t sorts file listings by last modified date

To use more than one flag, concatenate them:ls -ltls -lt

Page 39: Unix.ppt

Using Wildcards with lsls

ls a*ls a* - Wildcard, All files starting with 'a' ls *a*ls *a* - All filenames with 'a' in them ls *a*htmlls *a*html - All filenames with 'a' in them and

ending with html ls ?????ls ????? - All 5 charater filenames ls [abc]*ls [abc]* - All filenames starting with a, b, or c ls [a-c]*ls [a-c]* - Same as above but done as a range ls [^a-c]*ls [^a-c]* - All filenames not starting with a, b, or c

Page 40: Unix.ppt

The Unix Copy Command

cp cp can be used to make a copy of a file, leaving the original file untouched

Syntax:cp oldfile [path/]newfilecp oldfile [path/]newfile

To make a copy of a file while both the original and copy are in the same directory:cp index.html home.htmlcp index.html home.html

Page 41: Unix.ppt

The Unix Copy Command

To make a copy of a file that results in the copy retaining the original’s name, but is housed in a different directory:cp index.html ../academic/cp index.html ../academic/

To make a copy of a file that results in the copy having a new name and is housed in a different directory:cp index.html ../academic/home.htmlcp index.html ../academic/home.html

Page 42: Unix.ppt

The Unix Move Command

The mvmv command has two purposes:– To move files from one directory to another– To rename files

Syntax:mv oldfile newpath/[newfilename]mv oldfile newpath/[newfilename]

To move a file from one directory to another:mv index.html ../friends/mv index.html ../friends/

Page 43: Unix.ppt

The Unix Move Command

To rename a file (stays in the same directory):mv index.html home.htmlmv index.html home.html

To move a file and rename it at the same time: mv index.html ../friends/home.htmlmv index.html ../friends/home.html

Page 44: Unix.ppt

Deleting Files

Use rmrm to delete files Syntax:rm filenamerm filename

To delete a single file:rm index.htmlrm index.html(answer Y to confirm delete)

To delete multiple files using a wildcard:rm *.htmlrm *.html(answer Y to confirm delete for each file)

Page 45: Unix.ppt

Deleting Directories

Use rmdirrmdir to delete directories DIRECTORY MUST BE EMPTY!!!! Syntax:rmdir directorynamermdir directoryname

To delete a directory:rmdir images/rmdir images/(answer Y to confirm delete)

Page 46: Unix.ppt

Other Useful Commands

passwd passwd – Password utility that allows users to update their passwords

exit exit – End your Unix session (you can also use byebye on Phoenix)

clear clear – Gives you a blank screen (you can also use cls cls on Phoenix)

who who – Lists users currently logged in to the server

Page 47: Unix.ppt

Other Useful Commands

finger username finger username – Retrieves information about a user

cal cal – Displays a calendar of the current month date date – Displays the current system date !! !! – (pronounced “bang bang”) repeats the last

command ![a..z]![a..z] – Repeats the last command

beginning with selected letter (a-z)

Page 48: Unix.ppt

Other Useful Commands

|more|more – Added to commands which display lists to force page stops (Ex: ls –lt |morels –lt |more)

C-z C-z – Temporarily stop a process fg fg – Bring a process to the foreground after it

has been stopped vacation vacation – Turn on the autoreply for e-mail pine pine – Launch the Pine E-mail client emacs emacs – Start the Emacs editor

Page 49: Unix.ppt

Online Manual

Eight Sections– Commands– System calls– Library functions– Devices and device drivers– File formats– Games– Miscellaneous– System maintenance

Page 50: Unix.ppt

Using manman

man commandman command To lookup help on the cpcp command:man cpman cp

To lookup help on the lsls command:man lsman ls

C-cC-c exits the manual.

Page 51: Unix.ppt

Questions?


Recommended