Operating Systems An Introduction to Operating Systems Using UNIX CMSC 104, Lecture 03

advertisement

Operating Systems

An Introduction to Operating Systems

Using UNIX

CMSC 104, Lecture 03 1

What is an Operating System (OS)?

• A computer program

• Performs many operations:

• Allows you to communicate with the computer

(tell it what to do)

• Controls access (login) to the computer

• Keeps track of all “processes” currently running

• At this point, your main concern is how to communicate with the computer using the OS

CMSC 104, Lecture 03 2

How Do I Communicate With the

Computer Using the OS?

• You communicate using the particular OS’s user interface

• Graphical User Interface (GUI) - Windows

• Command-driven interface - DOS, UNIX,

Linux

• We will be using Linux, which is very similar to

UNIX

CMSC 104, Lecture 03 3

How Do I Communicate With the

Computer Using the OS?

• When you log in to the Linux system here, a user prompt will be displayed: linux1[#]% _ where # is the “number” of the command that you are about to type

• If this prompt is not on the screen at any time, you are not communicating with the OS

CMSC 104, Lecture 03 4

UNIX Overview

Files

Directories

Commands

Resources o books o links from course homepage

CMSC 104, Lecture 03 5

UNIX Files

A file is a sequence of bytes

Created by text editor (emacs, pico)

Created by other programs

May contain a program, data, a document, or other information (but all are text)

Files which contain other files are called

“directories” (sometimes called folders)

CMSC 104, Lecture 03 6

Filenames

Restrictions o no blanks, no metacharacters , length o case sensitive

Wildcards : * ?

CMSC 104, Lecture 03 7

Directories

• Directories can contain files or other directories called subdirectories

• Directories are organized in a hierarchical fashion

• They help us to keep our files organized

CMSC 104, Lecture 03 8

Directories

/afs/umbc.edu/users/b/o/bob junk pie recipes cookie apple peach choc_chip

CMSC 104, Lecture 03 9

Directories

• Your home directory is where you are located when you log in

The current directory is where you are located at any time while you are using the system

• Files within the same directory must be given unique names paths allow us to give the same name to different files located in different directories

• Each running program has a current directory and all filenames are implicitly assumed to start with the name of that directory unless they begin with a slash

CMSC 104, Lecture 03 10

Subdirectories

Organizing your files

For example o make a subdirectory for CS104 o make subdirectories for each project

CMSC 104, Lecture 03 11

Moving in the Directory Tree

.

(dot) is the current directory

. .

(dot-dot) is the parent directory

UNIX command cd “change directory”

Use dot-dot to move up the tree

Use directory name to move down

Use complete directory name (path name) to move anywhere

CMSC 104, Lecture 03 12

Commands

• cp, mv, ls, rm, more, cat, cd, pwd mkdir, rmdir, passwd, man, lpr redirection: | < > ctl-c, ctl-d

CMSC 104, Lecture 03 13

Download