130
THE COMPUTER OPERATING SYSTEM

Part III the Computer Operating System

Embed Size (px)

DESCRIPTION

Part III the Computer Operating System

Citation preview

Page 1: Part III the Computer Operating System

THE COMPUTER OPERATING SYSTEM

Page 2: Part III the Computer Operating System

Operating System

• An operating system, or OS, is a software program that enables the computer hardware to communicate and operate with the computer software. Without a computer operating system, a computer would be useless.

• The operating system is the most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.

Page 3: Part III the Computer Operating System

Home > operating system

operating system•          

                                                                                                              

Page 4: Part III the Computer Operating System

Linux vs. Windows

• Users who are considering making a change from Windows to Linux or Linux to Windows commonly want to know the advantages and disadvantages of each of the operating systems. Below is a chart to help illustrate the major advantages and disadvantages of each of these operating systems.

Page 5: Part III the Computer Operating System

Topic Linux Windows

PriceThe majority of Linux variants are available for free or at a much lower price than Microsoft Windows.

Microsoft Windows can run between $50.00 - $150.00 US dollars per each license copy.

Ease

Although the majority Linux variants have improved dramatically in ease of use, Windows is still much easier to use for new computer users.

Microsoft has made several advancements and changes that have made it a much easier to use operating system, and although arguably it may not be the easiest operating system, it is still Easier than Linux.

Reliability

The majority of Linux variants and versions are notoriously reliable and can often run for months and years without needing to be rebooted.

Although Microsoft Windows has made great improvements in reliability over the last few versions of Windows, it still cannot match the reliability of Linux.

Page 6: Part III the Computer Operating System

Software

Linux has a large variety of available softwareprograms, utilities, and games. However, Windows has a much larger selection of available software.

Because of the large amount of Microsoft Windows users, there is a much larger selection of available software programs, utilities, and games for Windows.

Software Cost

Many of the available software programs, utilities, and games available on Linux are freeware or open source. Even such complex programs such as Gimp, OpenOffice, StarOffice, and wine are available for free or at a low cost.

Although Windows does have softwareprograms, utilities, and games for free, the majority of the programs will cost anywhere between $20.00 - $200.00+ US dollars per copy.

Hardware

Linux companies and hardware manufacturers have made great advancements in hardware support for Linux and today Linux will support most hardware devices. However, many companies still do not offer drivers or support for their hardware in Linux.

Because of the amount of Microsoft Windows users and the broader driver support, Windows has a much larger support for hardware devices and a good majority of hardware manufacturers will support their products in Microsoft Windows.

Page 7: Part III the Computer Operating System

Security

Linux is and has always been a very secure operating system. Although it still can be attacked when compared to Windows, it much more secure.

Although Microsoft has made great improvements over the years with security on their operating system, their operating system continues to be the most vulnerable to viruses and other attacks.

Open Source

Many of the Linux variants and many Linux programs are open source and enable users to customize or modify the code however they wish to.

Microsoft Windows is not open source and the majority of Windows programs are not open source.

Support

Although it may be more difficult to find users familiar with all Linux variants, there are vast amounts of available online documentation and help, available books, and support available for Linux.

Microsoft Windows includes its own help section, has vast amount of available online documentation and help, as well as books on each of the versions of Windows.

Page 8: Part III the Computer Operating System

Command line vs. GUI

• Users not familiar with a command line interface (CLI) or a graphic user interface (GUI) may want to know the advantages and disadvantages of each interface to help determine what interface is the best for them to use and why. Below is a table to help illustrate the major advantages and disadvantages of each of the interfaces.

Page 9: Part III the Computer Operating System

Topic Command line (CLI) GUI

Ease

Because of the memorization and familiarity needed to operate a command line interface, new users have a difficult time navigating and operating a command line interface.

Although new users may have a difficult time learning to use the mouse and all GUI features, most users pick up this interface much easier when compared to a command line interface.

Control

Users have much more control of their file system and operating system in a command line interface. For example, users can copy a specific file from one location to another with a one-line command.

Although a GUI offers plenty of control of a file system and operating system, the more advanced tasks may still need a command line.

Multitasking

Although many command line environments are capable of multitasking, they do not offer the same ease and ability to view multiple things at once on one screen.

GUI users have windows that enable a user to view, control, and manipulate multiple things at once and is much faster to navigate when compared with a command line.

Page 10: Part III the Computer Operating System

Speed

Command line users only need to use their keyboards to navigate a command line interface and often only need to execute a few lines to perform a task.

A GUI may be easier to use because of the mouse. However, using a mouse and keyboard to navigate and control your operating system for many things is going to be much slower than someone who is working in a command line.

Resources

A computer that is only using the command line takes a lot less of the computers system resources than a GUI.

A GUI requires more system resources because of each of the elements that need to be loaded such as icons, fonts, etc. In addition, video drivers, mouse drivers, and other drivers that need to be loaded will also take additional resources.

Scripting

A command line interface enables a user to script a sequence of commands to perform a task or execute a program.

Although A GUI enables a user to create shortcuts, tasks, or other similar actions, it doesn't even come close in comparison to what is available through a command line.

Page 11: Part III the Computer Operating System

Remote access

When accessing another computer or networking device over a network, a user will only be able to manipulate the device or its files using a command line interface.

Although remote graphical access is possible. Not all computers and especially not all network equipment will have this ability.

Diverse

After you've learned how to navigate and use a command line, it's not going to change as much as a new GUI. Although new commands may be introduced, the original commands always remain the same.

Each GUI has a different design and structure of how to perform different tasks. Even different versions of the same GUI, such as Windows, can have hundreds of different changes between each version.

Strain

The command line allows the user to keep their hands on the keyboard and rarely have to move from the keyboard to the mouse. Moving back and forth between a keyboard and mouse can cause additional strain and may help contribute to Carpal Tunnel.

Although shortcut keys can be learned to help reduce the amount of times you have move from the keyboard to the mouse, you will still be moving much more between the keyboard and mouse with a GUI.

Page 12: Part III the Computer Operating System

Common operating systems• The operating system is the computer's most important piece of

software. It manages the hardware resources, determines which programs are compatible with the system and executes those programs when the user decides to run them. Its influence on the nuts and bolts of computer operation makes it a major determining factor when it comes to the user's experience. A given operating system has not only its own functionality, but a unique look and feel that creates a specific environment. Each of the world's major operating systems has its own passionate following, prompting endless debate on which is superior, and for what. Learning about them in the face of this shifting competitive landscape requires understanding certain basics principles.

Page 13: Part III the Computer Operating System

Linux • Ubuntu• Debian• MEPIS• openSUSE• SUSE Enterprise Linux• Fedora• Red Hat Enterprise Linux• CentOS• Mandriva• Xandros• Linspire (previously known as "LindowsOS")• Gentoo• Slackware

Page 14: Part III the Computer Operating System

Ubuntu• Ubuntu is based on a version of the Linux operating system

known as Debian GNU/Linux. Its main benefit is that it's free and open source. This means users can alter the code as they see fit. Ubuntu also stands out because it's updated once every six months, unlike other open source programs that have no strict upgrade schedule. Most Ubuntu-compatible software is also free and available in on-line software "repositories." Users can try Ubuntu on their PC using the program's "Live CD" mode. This allows you to run the system without actually installing it on your computer. Because Ubuntu programs are less ubiquitous than those for more well-known systems, users may need to do some research before finding the software solutions they need.

Page 15: Part III the Computer Operating System

Android• Android is a "mobile" operating system maintained by the Open

Handset Alliance, a group of companies and organizations that contribute to the system's development under the management of Google Inc. The system is an "open standard," meaning that an entire community of developers can alter the software, not just Google. Android comes pre-installed on smartphones and tablet PCs for which it was designed. As of the date of publication, all four major smartphone carriers -- Verizon, T-Mobile, Sprint and AT&T -- have Android devices available. A variety of manufacturers also make Android-compatible devices. One of the main benefits of the system's open source status is that developers can create different versions of its basic programs, allowing users greater freedom to customize their mobile devices.

Page 16: Part III the Computer Operating System
Page 17: Part III the Computer Operating System

IOS

• IOS (previously iPhone OS) is Apple's mobile operating system. It runs on the company's iPod, iPhone and iPad devices. Like Mac OS X, it can only be used on Apple's mobile devices. One advantage of iOS is that more applications are available for it than for any other mobile operating system. As of summer 2011, it has approximately 400,000 to Android's 300,000. This increases the chances that users will find the type of app they're looking for. The system's key features include multitasking support, which allows users to run multiple apps simultaneously, and FaceTime, a video chat program that comes pre-installed on iOS devices.

Page 18: Part III the Computer Operating System
Page 19: Part III the Computer Operating System

Mac OS X

• While a version of Mac OS X comes pre-installed on all Apple Macintosh computers, users must pay if they wish to use newer versions when they become available. The system is not open source, so only Apple developers have the ability to legitimately make alterations or improvements to its code. It differs from other computer operating systems in that it only works on Apple computers. Its key feature is its usability. The most recent version as of the date of publication includes a "resume" feature that re-opens applications in the same state they were in when you last closed them. It also includes a "Mission Control" feature, which allows you to see all of your open files at a glance.

Page 20: Part III the Computer Operating System

Mac OS (Apple Macintosh)

• Mac OS X v10.5 (Leopard)• Mac OS X v10.4 (Tiger)• Mac OS X v10.3 (Panther)• Mac OS X v10.2 (Jaguar)• Mac OS X v10.1 (Puma)• Mac OS X v10.0 (Cheetah)• Mac OS 9• Mac OS 8• Mac OS 7.6 (first officially-named Mac OS)• System 7 (code-named "Big Bang")• System Software 6 and earlier

Page 21: Part III the Computer Operating System

Windows• Windows is an operating system owned and operated by Microsoft.

It differs from open source systems in that only Microsoft has the ability to make changes to the code. However, it also differs from Mac OS X in that it can be installed on a variety of different computers from a host of competing manufacturers, offering the user more freedom of choice when it comes to hardware. According to Net Market Share, Windows is the most widely used operating system. The latest version as of the date of publication includes touchscreen support, which combines the usability of a touchscreen tablet with the power of a desktop computer. It also features "Play To" and "Remote Media Streaming," which allow you to play media from your computer on other devices in its vicinity and to access your media when you're away from your computer.

Page 22: Part III the Computer Operating System

Microsoft Windows• Windows 8 - to be released on October 26, 2012.• Windows 7• Windows Server 2008 R2 • Windows Mobile 6.5 for smartphones• Windows Phone 7 for smartphones• Windows Mobile 6.1 for smartphones and PDAs• Windows Server 2008 for servers.• Microsoft Windows Vista • Windows Server 2003• Microsoft Windows• Microsoft Windows• Windows NT 4.0• Windows Me• Windows 98 SE (Second Edition)• Windows 98 • Windows 95

Page 23: Part III the Computer Operating System

Future versions

• Windows 9, currently being developed as the successor to Windows 8, and scheduled for release in 2014 or later.

Page 24: Part III the Computer Operating System

24

Windows Command Line Interface(AKA DOS commands)

Page 25: Part III the Computer Operating System

25

What I did uptown• help, help dir• dir, dir /w, dir /?• fullpath, relative path, dot dot, dot• cd, md, rd, rd /s, rd /s/q• type• what is a binary number• ASCII files, binary files• diff bet notepad, word, excel,• copy, del• notepad• TODO

– .exe files– batch files– dir /od, dir /o-d

Page 26: Part III the Computer Operating System

26

What is the Windows Command Line Interface (CLI)?

• The windows command line interface (CLI) provides a way to control your computer by typing "English-like" commands instead of clicking on buttons, icons, menus, etc.

• For example you can use the windows CLI to – start a program– create a folder– remove a folder– copy a file– remove a file– rename a file– etc.

Page 27: Part III the Computer Operating System

27

What is “DOS”

• The Windows CLI commands are sometimes referred to as "DOS" commands.– DOS was the name of the operating system that

predated Windows (it stands for Disk Operating System).

– The only way to control DOS was to use these commands

– The commands in the modern Windows Command Line interface are very similar to the original DOS commands, but there are some differences and some completely new commands.

Page 28: Part III the Computer Operating System

28

CLI vs. DOS

• Terminology– Even though it's not totally accurate to call the Windows

CLI commands "DOS" commands, we will continue to use that term since many people use that term.

– Sometimes we will simply use the term “DOS” without the word commands.

• The following terms will be used interchangeably– Windows CLI– DOS commands– DOS

Page 29: Part III the Computer Operating System

29

Why should you use the command line interface (i.e. DOS commands)?

• Many windows users will never have a need for the DOS commands

• DOS commands are useful or required for many administrative or programming tasks

• For example, using DOS commands one can write programs to automate many administrative tasks.

Page 30: Part III the Computer Operating System

30

DOS Commands that we will discuss(there are many others)

• Basic DOS commands– help– help <command name>– dir [/w][/s][/?][/od][/o-d][/oe][/o-e] etc. – cd– md– rd [/s][/q]– move– copy– xcopy [/s][/e]– del / erase (these are synonyms)– ren– type– tree [/f][/a]– cls– ver– fc– find

• File and folder paths– dot (i.e. .)– dot dot (i.e. ..)– full path (AKA absolute path)– relative path

• Types of files – ASCII files– Binary files– "type" only works with ASCII files– notepad vs. word

Page 31: Part III the Computer Operating System

31

DOS Commands that we will discuss(there are many others)

• Redirection– > overwrite– >> append– | pipe

• Filter commands (can use with | )– more– sort

• Running programs– Filename extensions (eg. .txt .doc .xls)– executable files (.exe)– running a program– windows explorer -

• view | details• tools | folder options | view

• Environment variables– set– set <var name>– set <var name> = <value>– path– %VarName%– control panel | system | advanced | environment variables

Page 32: Part III the Computer Operating System

32

More DOS commands

• File attributes (hidden, read only, archive)– attrib DOS Command– windows explorer - file properties

• Commands for scripting– rem– echo– echo on– echo off– @– exit– start– goto command and labels

• Command line arguments– %1 %2 %3 ... %9– shift

Page 33: Part III the Computer Operating System

33

Scripting Commands

• for• if• pause• echo <message>• echo on• echo off• @• shift

Page 34: Part III the Computer Operating System

34

Programs (AKA “external” DOS commands)

• notepad• cmd• regedit

Page 35: Part III the Computer Operating System

35

running / executing

• starting a program or DOS command is known as

“running” the program/command

OR

“executing” the program/command

Page 36: Part III the Computer Operating System

36

Case In-sensitive• DOS commands are case in-sensitive. • This means that you can type the commands in either UPPER

CASE, lower case OR a mixture of uPpEr AnD lOwEr CaSe.• For example the following are all equivalent ways of typing

the “dir” command

dir

DIR

dIr

DIr

dIR

Page 37: Part III the Computer Operating System

37

Type ENTER

• You must press the ENTER key after typing any DOS command for it to actually do anything.

Page 38: Part III the Computer Operating System

38

Conventions for this presentation• This presentation will use the following conventions when describing the

commands:

– Any part of a command that must be typed exactly will be shown as regular text. (see example below)

– Words between “angle brackets” are placeholders which you must fill in when you run the command.

– For example the following command is used to delete a file.

del <file name>

The description shows that you must type the word “del” (without the quotes) followed by the name of the file you want to delete. For example to actually delete the file named “myDocument.doc” you would type the following (and then press the ENTER key)

del myDocument.doc

Page 39: Part III the Computer Operating System

39

More conventions• This presentation will use the following conventions when describing the

commands:

– If a part of a command is optional it will be shown in square brackets.

– For example the following command is used to get help about the DOS commands.

help [<command name>]

– The description above shows that you can type the word “help” alone or type the word “help” followed by the name of a specific DOS command.

If you type the word “help” alone you will see a list of all the DOS commands and a short description of what each command is used for. Example (don’t forget to press the ENTER key):

help

You can also type the word “help” followed by the name of a specific DOS command to get more extensive help on that particular command. Example (don’t forget to press the ENTER key):

help dir

Page 40: Part III the Computer Operating System

40

THECOMMAND PROMPT

WINDOW

Page 41: Part III the Computer Operating System

41

The "command prompt" windowDOS commands are entered in a "command prompt" window:

Page 42: Part III the Computer Operating System

42

Starting the command prompt window

• To start a command window from "Windows XP -Home" choose the following menu choice from the start menu:

start | All Programs | Accessories | Command Prompt

Page 43: Part III the Computer Operating System

43

The prompt• The "c:\>" in the picture is called the "prompt"

(your prompt may look slightly different, such as "d:\>", "c:\somefolder>" or something similar - we'll explain later).

• The prompt is automatically displayed by the computer.• You type your commands after the prompt.• In order for a command you typed to do anything, you must press the "ENTER" key.• Commands may be entered either in UPPERCASE, lowercase.or MiXeDcAsE

Page 44: Part III the Computer Operating System

44

THEHELP

COMMAND

Page 45: Part III the Computer Operating System

45

help command• Type "help" follwed by the ENTER key to get a list

of the valid commands

(output of the "help" command is shown on the following slides)

Page 46: Part III the Computer Operating System

46

Output of help command

• The help command prints a lot of text to the command window.

• Some of the text will scroll off the screen.• use the scroll bar to view text that has scrolled off of

the screen.• (see next slide for example).

Page 47: Part III the Computer Operating System

47

Output of help commandOutput of

"help" command is

very long and scrolls

of the screen.

Use the scrollbar to see the rest of the text

Page 48: Part III the Computer Operating System

48

help <command>• To get detailed help about a specific command type the word "help"

(without the quotes) followed by the name of the command. • For example to get detailed help about the "dir" command, type the

following:

help dir

Output of

help dir

command

Page 49: Part III the Computer Operating System

49

| MORE

Page 50: Part III the Computer Operating System

50

| more• To view a lot of output, instead of using the scroll bar, you can

force the output of most commands to be displayed one screen at a time.

• Type the command followed by "| more" (without the quotes), for example:

c:\> help | more

• The vertical bar symbol (also called a pipe symbol) is located on the keyboard above the backslash ( \ ) character. On the keyboard it looks like a vertical line with a break in the middle`

This is what you typefollowed by the ENTER key

`

This is the prompt. It isprinted by the computer

Page 51: Part III the Computer Operating System

51

output of "help | more"• When you use "| more", the output from the command is displayed one

screenfull at a time• Below is the output of the command "help | more"• Press the spacebar to see the next screenfull of output.• Press the ENTER key to see the next line of output.• To quit seeing the output type "q" (for quit) or Ctrl-C (I’ll explain more about Ctrl-C soon)

Page 52: Part III the Computer Operating System

52

Using “| more” with other commands

• You can add “| more” (without the quotes) to the end of most commands to have the output of that command displayed one page at a time.

• For example, we will learn about both the “dir” and “type” commands later, both of which can be combined with “| more”. The following are both legal:

dir | more

type myfile.txt | more (for this to work, there must be a file named myfile.txt)

• We will learn more about what the “|” means later.

Page 53: Part III the Computer Operating System

53

"CTRL-C" (i.e. CONTROL-C)

Page 54: Part III the Computer Operating System

54

Stopping programs with Control-C (i.e. Ctrl-c)

• Sometimes DOS commands may "get stuck" and never complete or take a loooonnnng time to complete.

• This is sometimes refered to as a program that is "hanging"

• To terminate any DOS program or command you can press the "Cntrl" key and the "c" key at the same time while the program is running. (try to remember "c" is for "cancel")

• This key sequence is known as "Control-C" or "Ctrl-C“• For example you can use Ctrl-C to terminate the

"more" program instead of typing "q"

Page 55: Part III the Computer Operating System

55

INCREASE THE SIZEOF THE

COMMAND WINDOW

Page 56: Part III the Computer Operating System

56

Changing the propertiesof the command window

• Another way to see more information at once is to increase the height of the command window

• To do that, "left click" on the icon in the upper left hand corner of the window and choose "Properties"

Page 57: Part III the Computer Operating System

57

Increasing the height of the command window

• choose the "Layout" tab.

• change the value of the "Height" field in the "Window Size" section

• this is the number of lines of output that is displayed in the command window. (the default value is 24)

• press the "OK" button

Page 58: Part III the Computer Operating System

58

Apply the changes• finally, you will see this dialog

box

• If you choose "Apply properties to current window only" then the next time you start a command window the new window will be the original size

• If you choose "Modify shortcut that started this window" then then next time that you start a command window it will be the larger size.

• Make a choice (either is fine) and press the "OK" button.

Page 59: Part III the Computer Operating System

59

result - larger command window

Page 60: Part III the Computer Operating System

60

BASIC COMMANDS (DIR, MD, CD, RD)

Page 61: Part III the Computer Operating System

61

Directories (AKA Folders)

• In DOS, a "folder" is called a "directory"

• A folder and a directory are exactly the same thing - the words are interchangeable.

Page 62: Part III the Computer Operating System

62

DIR command

• The DIR command shows the contents of a directory (AKA folder).

• This is the same information that you can see in Windows Explorer

• Simply type the word "dir" followed by the ENTER key• The output of the command is shown on the next slide

Page 63: Part III the Computer Operating System

63

OUTPUT OF DIR EXPLAINED (1 of 2)

A line with <DIR> on it indicates a directory name. Line without <DIR> show file names.

These are the names of files and directories (i.e. folders) that are contained in the directory being listed (i.e. C:\)

This is the directory (i.e. folder) whose contents are being listed. C:\ means the top directory on the C: drive (AKA the “root” of the C: drive)

Page 64: Part III the Computer Operating System

64

OUTPUT OF DIR EXPLAINED (2 of 2)The date and time are the date/time that the file or directory was created or last modified.

These numbers indicate the size of the files in bytes. (Directories don’t display a size.) A file with a size of zero (0) is an empty file (i.e. it has nothing in it).

Page 65: Part III the Computer Operating System

65

Files and Directories

• The output of the DIR command shows a list of files and directories

• The date/time at the start of each line is the last time that file or folder was modified.

• The names that are preceded by "<DIR>" are directory names. The other names are names of files. For example, in the previous slide– "005-v01-chap2-partII.ppt" is a filename– "AUTOEXEC.BAT" is a filename– "Chap02" is a directory name– "Chap11" is a directory name– "CONFIG.SYS" is a filename– etc.

Page 66: Part III the Computer Operating System

66

One directory (i.e. folder) at a time

• It is important to understand that the DIR command shows the contents of only one directory (i.e. folder) at a time.

• The output shown above shows the contents of the highest level folder (also known as the “root”) of the C: drive.

• You can see the same information in “Windows Explorer” (we’ll show you the output of the dir command compared with what you see with windows explorer)

Page 67: Part III the Computer Operating System

67

Switching Drives

• To switch the disk drive that you are working with, type the letter for the diskdrive followed by a colon ( e.g. d: )

• Don’t leave any spaces between the letter and the colon• The prompt will change to show the new drive.

You type this

The prompt changes to show the new drive name

Page 68: Part III the Computer Operating System

68

Directory of D:

• The DIR command will now show the contents of the folder at the top of the D: drive (i.e. the “root” of D: )

files and directories in the “root” directory of the D: drive

Page 69: Part III the Computer Operating System

69

Switch back to C: drive• To switch back

to the C: drive type “C:” followed by ENTER.

• To switch to any drive by type the drive letter followed by a colon followed by ENTER

Page 70: Part III the Computer Operating System

70

DOS vs. Windows Explorer

DOS shows the same files and folders as Windows Explorer does

DO

SW

indo

ws

Expl

orer

Page 71: Part III the Computer Operating System

71

dot (.) and dot dot (..)• DOS uses two special directories, dot (.) and dot dot (..), that don’t

appear in Windows Explorer.• We’ll describe these more later ...

Page 72: Part III the Computer Operating System

72

TREE command• The TREE

command shows the hierarchy of directories

• You can see the same info from Windows Explorer

DO

SW

indo

ws

Expl

orer

Page 73: Part III the Computer Operating System

73

NAMING DISK DRIVES, DIRECTORIES (AKA folders), AND FILES

Page 74: Part III the Computer Operating System

74

DIR <path>

• To display the contents of a different folder with DIR, you must specify the name of the directory.

• EXAMPLE: The following shows the contents of the “accounting” directory that is in the “schoolWork” directory that is in the root of the D: drive:

DIR d:\schoolWork\accounting

• See next slide ...

Page 75: Part III the Computer Operating System

75

Example

• To see the contents of the accounting directory typedir d:\schoolWork\accounting

Contents of accounting directory

Page 76: Part III the Computer Operating System

76

Command Line Arguments

• The information that is specified after the name of the command are called command line arguments

• Example: In the following command:

dir d:\schoolWork\accounting

"dir" is the name of the command and "d:\schoolWork\accounting" is a command line argument

Page 77: Part III the Computer Operating System

77

Accessing the hierarchy from DOS

• The hierarchy of disk drives, folders and files that is accessible from Windows Explorer is also accessible from DOS

• However you must how to name the following from DOS– disk drives– directories– files

Page 78: Part III the Computer Operating System

78

Disk drive names

• DOS uses a single letter followed by a colon to name each disk drive.

• These are the same names that Windows Explorer shows in parentheses (see next slide).– A: is usually reserved for the floppy drive– C: is usually reserved for a local hard drive– Other drive letters are either for

• other local hard drives • drives that are on another computer but which are

accessible over the network• Other types of drives such as CD-ROM or DVD drives.

Page 79: Part III the Computer Operating System

79

Lets see Windows Explorer again (continued on next slide)

DOS drive letters

Page 80: Part III the Computer Operating System

80

Path to a file or folder

• The location of a particular file or directory is specified in DOS using a "path"

• A “full path” (or "absolute" path) is comprised of – the name of a disk drive that the file or folder is

on, backslash ( \ ) characters, folder names and an optional file name.

• ExampleD:\otherStuff\NTFSDOS3\readme.txtdrive letter folder names file name

Page 81: Part III the Computer Operating System

81

Example explained

• The example on the previous page is repeated here

D:\otherStuff\NTFSDOS3\readme.txt

• This path represents the "readme.txt" file that is stored in the "NTFSDOS3" folder which is in turn stored in the "otherStuff" folder on the D: drive

Page 82: Part III the Computer Operating System

82

Backslash (\) vs. Forward slash (/)• Don't confuse the

backslash (\) with the forward slash (/) !

• On standard keyboards:– the backslash (\) is

located directly above the ENTER key.

– the forward slash (/) is located next to the shift key on the right hand side of the keyboard

forward slashbackslash

Page 83: Part III the Computer Operating System

83

backslash in filenamesforward slash for command

options• backslash is used for naming files and

directories• forward slash is used to provide options to

DOS commands (we'll cover this later)

Page 84: Part III the Computer Operating System

84

spaces in filenames

• If any folder or filename in a path contains spaces, you must surround the entire path with quotes when using it in a DOS command.

• Example

dir "c:\my folder\my file.txt"

Page 85: Part III the Computer Operating System

85

The root

• The top level of any disk drive is called the "root" of the disk drive.

• The root is indicated by a single backslash ("\") character. For example:– the root of the C: drive is C:\– the root of the A: drive is A:\– the root of the D: drive is D:\– etc.

Page 86: Part III the Computer Operating System

86

Trees, root, parent, child

Page 87: Part III the Computer Operating System

87

The "current directory“ or “working directory”

• Windows– As noted above, the right hand pane of Windows Explorer

shows the files that are in the folder which is currently selected in the left hand pane.

– You can think of the currently selected folder as the "current folder" or "current directory".

– From the snapshot on the previous slide, "NTFSDOS3" is the "current folder"

• DOS– In a similar way DOS uses the concept of a currently

selected directory otherwise known as "the current directory" (sometimes the "current directory" is called the "working directory").

Page 88: Part III the Computer Operating System

88

Which directory is the working directory?

• By default, the DOS prompt indicates which directory is the current directory, also known as the “working” directory.

• The prompt in the slides looked like: C:\>

– "C:" indicates that the current directory is on the C: drive.– "\" after the colon indicates that the current directory is

the top level directory (on the C: drive). – ">" is not part of the name of the current directory. It is

simply indicates the end of the prompt.

Page 89: Part III the Computer Operating System

89

DOS command options and switches

• Most DOS commands can be run in different ways by specifying “options” (also known as “switches”).

• You specify an option by typing a forward slash (/) after the command name followed by one or more letters or characters that specify which option you want to use.

• See example on next slide

Page 90: Part III the Computer Operating System

90

DIR /w• The /w

option for the DIR command shows the output in a “wide” format.

• Execute the command by typing “dir /w”

output of “DIR” command

Page 91: Part III the Computer Operating System

91

DIR /?

Page 92: Part III the Computer Operating System

92

DIR /on

Page 93: Part III the Computer Operating System

93

DIR /o-n

Page 94: Part III the Computer Operating System

94

DIR /od

Page 95: Part III the Computer Operating System

95

DIR /o-d

Page 96: Part III the Computer Operating System

96

MD (make directory) command

• Use the MD command to make a new directory that will be stored under the current directory.

• The syntax is

MD <directory name>

• For example the following will create a directory named "entertainment" that is stored under the current directory

md entertainment

Page 97: Part III the Computer Operating System

97

MD command has no output

• If the MD command is successful it does not display any output

Page 98: Part III the Computer Operating System

98

See the new directory

• To see the new directory run the DIR command(output of DIR command)

Page 99: Part III the Computer Operating System

99

CD command(change the current directory)

• Use the CD command to change the current directory.

• The syntax is

CD <directory name>

• For example the following will change the current directory to the new "entertainment" directory.

cd entertainment

Page 100: Part III the Computer Operating System

100

CD command - changes the prompt

• If the CD command is successful it does not display any output• However the prompt changes to reflect the new "current

directory"

Page 101: Part III the Computer Operating System

101

CD to a full path

Page 102: Part III the Computer Operating System

102

CD to a longer full path

Page 103: Part III the Computer Operating System

103

CD to a folder “below” the current folder

Page 104: Part III the Computer Operating System

104

CD to the parent directory

Page 105: Part III the Computer Operating System

105

CD to the parent of the parent directory

Page 106: Part III the Computer Operating System

106

The contents of an “empty” directory

Page 107: Part III the Computer Operating System

107

CD to a sibling directory by way of parent

Page 108: Part III the Computer Operating System

108

“Full path” vs. “relative path”

Page 109: Part III the Computer Operating System

109

drive letter

Page 110: Part III the Computer Operating System

110

<drive letter>:(change drive command)

Page 111: Part III the Computer Operating System

111

CD to a folder on a different drive

Page 112: Part III the Computer Operating System

112

Each drive remembers its working directory

Page 113: Part III the Computer Operating System

113

Making a directory (MD) using a full path or a relative path

Page 114: Part III the Computer Operating System

114

OTHER COMMANDS

Page 115: Part III the Computer Operating System

115

CLS Command

• Type the CLS command followed by ENTER to clear the screen.

Page 116: Part III the Computer Operating System

116

Type

Page 117: Part III the Computer Operating System

117

ASCII files vs. Binary Files

Page 118: Part III the Computer Operating System

118

Difference between Notepad and Word

Page 119: Part III the Computer Operating System

119

TODO

• tree hierarchy – parent, child, root, leaf• help dir

– options / switches– optional parts of command

Page 120: Part III the Computer Operating System

120

• wildcards * and ?• dir with wildcards• Files, extensions• copy• del vs, rd• .exe files• path• rd• ren• set• cmd /k

Page 121: Part III the Computer Operating System

121

APPENDICES

Page 122: Part III the Computer Operating System

122

MORE ABOUT DISK DRIVES

Page 123: Part III the Computer Operating System

123

Fixed drives vs Removable Media drives

• There are two types of drives– Fixed Drives

• for example a hard drive

– Removable media drives• for example a floppy disk drive, CDROM drive or DVD

drive

Page 124: Part III the Computer Operating System

124

Removable media drives

Page 125: Part III the Computer Operating System

125

Disk Drives and Media

• Examples of Disk Drives– Hard Disk drive– Floppy disk drive – CDROM drive– DVD drive

• Examples of Disk Drive Media– floppy disk– CDROM disc– DVD disc

Page 126: Part III the Computer Operating System

126

COMPARING FILES

date/time stamps and files sizes

FC command

Page 127: Part III the Computer Operating System

127

Date/time stamps and file sizes

• If two files have the same date/time and the same exact file size, then they probably contain the same exact information. However, it is possible that they contain different information

• The FC (file compare) command compares two files to see if they are exactly the same. This will tell you if two files are the same even if they have different date/time stamps.

• Example: FC file1.txt file2.txt

For complete information on the FC command run FC /? or HELP FC

Page 128: Part III the Computer Operating System

128

CONTROL CHARACTERS

Page 129: Part III the Computer Operating System

129

Control characters• Control-C is an example of a “control character”• There are 26 control characters, one for each letter.• There is no distinction between capital and

lowercase letters: Ctrl-C (capital “C”) is the same as Ctrl-c (lowercase “c”)

• Some control characters have special meaning. For example: – Ctrl-H is another way of typing a backspace character (try

it out in a command window)– Ctrl-M is another way of typing the ENTER key

(try typing “dir” followed by ctrl-M)• Sometimes control characters are shown with a ^

character followed by the letter. For example control-A can be shown as ^A

Page 130: Part III the Computer Operating System

130

Control characters and ASCII

• The 26 control characters correspond to the first 26 numbers in the ASCII table.

• TODO: talk about ASCII