lecture2-command line interface

56
1 Command Line Interface

Upload: surjit-singh

Post on 17-Dec-2015

268 views

Category:

Documents


3 download

DESCRIPTION

DOS commands

TRANSCRIPT

  • Command Line Interface

  • Lecture ObjectivesExplain the operation of the command line interfaceExecute fundamental commands from the command line interfaceManipulate files and folders from the command line

  • How does the Command Line Work?Similar to Instant Message conversation with computerThe prompt indicates that the computer is ready to receive a commandCommand is typed and ENTER is pressedPC executes commandPrompt is displayed, indicating that the computer is waiting for the next command

  • Accessing the Command LineRun dialog boxStart menu under Programs | AccessoriesWin 9x/Me link is named MS-DOS promptWin NT, 2000, XP link is called Command PromptTo close command line interfaceType Exit at command line and press enterClose the window

  • Command PromptVERY IMPORTANT:The command prompt is always focused on a specific folder.Any commands executed are performed on the files in the folder on which the prompt is focused.Examples: C:\> root directory of C: driveC:\Diploma\APLUS>You must focus the prompt on the drive and folder where you want to work

  • Filenames and File FormatsIn Windows, each program and piece of data is stored as an individual fileEach file has a name, stored with the file on the driveNames have 2 parts: filename and extension

  • Eight-dot-Three naming systemFile name cannot be more that 8 chrsExtension can be up to 3 chrs, OPTIONALFollowing chrs cannot be used in filename or extension:/ \ [ ] | = + ; , * ? And division symbol

  • Windows naming rulesAll versions starting with Win 9x are not limited be 8.3Filenames up to 255 chrsWin 9x has backward compatibility with DOS by creating 2 names for every file, 8.3 name and a long file name if necessary

  • File extensionsDescribes the type or function of the fileCOM = command, EXE = executableAnything that is not a program is a data file used by a programExtension of a data file indicates which program uses that data file.DOC = MSWord, .PPT = PowerPointGraphic file extensions represent the graphic standard used to create the image.JPEG =Joint Photographic Experts Group

  • File FormatsAll files stored on hard drive in binary formatEvery program is unique in the way it reads and writes this binary dataEach unique way of binary organization is known as a file formatOne program cannot read another programs files unless it can convert the other programs format

  • Drives and FoldersTo execute commands from the command line, must focus the prompt at the specific drive and folder that contains the files or program with which you want to workAt boot, Win assigns letters to drives and drive partitions

  • Hierarchical Directory TreeAll files are put in groups called foldersAny file not in a folder within the tree is said to be in the root directoryA folder inside another folder is called a subfolderAny folder can have multiple subfolders

  • Hierarchical Directory TreeHard drive is represented by C:Root directory is indicated by \, C:\Subdirectories/Subfolders are indicated by adding \ and the directory nameExact location of a file is known as its PATH

  • Fundamental CommandsALL commands use similar structure and execute in the same wayName of command , target of command followed by any switches (extra numbers or letters at the end)Typing the command followed /? Displays help menu describing syntax and possible switches

  • DIR CommandContents of the directory where the prompt is focusedLists the following:FilenameExtensionFile size in bytesCreation date/timeDIR/W command shows you only the file namesDIR/? Shows the help menu

  • CD Command (Directories)Change focus of command prompt to a different directoryCD\ followed by directory nameIf directory does not exist, error messageInvalid DirectoryThe system cannot find the path specifiedReturn to root directory by typing CD\

  • Moving Between DirectoriesCD NOT used to move between drivesType drive letter followed by colonIf drive does not exist:Invalid drive specificationThe system cannot find the specified drive

  • Making DirectoriesTo make a directoryTo make a directory called QUAKE3 under root directory: C:\>MD QUAKE3, press ENTERIf command is successfully executed, the command prompt will be displayedUse DIR to verify that directory was created

  • Removing DirectoriesReverse of MDGo to directory that contains the subdirectory you want to deleteExecute RD commandRD will not delete directory if it contains subdirectories or files

  • Running a ProgramChange focus of prompt to the folder where program is locatedType name of programPress ENTER

  • Working with FilesAll files have 4 basic attributes:HiddenRead-onlySystemArchiveRefer to photocopy for specific example of attribute command

  • Renaming FilesREN or RENAME command (refer to photocopy for example)

  • Delete FilesUse DEL commandCareful! No recycle bin.Erased file can only be recovered using Norton UneraseCan delete multiple files using wild cards

  • Copying and Moving FilesFocus prompt on directory containing the file or folder to be copiedType COPY or MOVE and a spaceType name(s) of the file(s) to be copied/moved and a spaceType the path of new location for the files (Refer to example on photocopy)

  • The Software Core

  • A Short History of MS-DOS

  • Understanding DOS All versions were built for a specific class of CPU.MS-DOS never overcame critical limitations.All versions used a command-line interface.You must use the DOS prompt to set up a new system or hard disk drive.

  • DOS Boot Sequence and Files Three core programs IO.SYSMSDOS.SYSCOMMAND.COM Two optional startup files CONFIG.SYSAUTOEXEC.BAT

  • Summary of Steps in Booting the System The power-on self test (POST) runs and invokes the operating system (OS).The read-only memory basic input/output system (ROM BIOS) looks for an OS and checks for IO.SYS and MSDOS.SYS.The OS processes CONFIG.SYS, if present.COMMAND.COM is loaded.The OS processes AUTOEXEC.BAT, if present.COMMAND.COM presents the active-drive prompt.

  • The DOS File System The file is the primary unit of data storage.Files are organized into directories.File and directory names can be up to eight characters long, followed by a period and a three-character extension.Some universal extensions are .exe, .com, .sys, .bat, .txt, .doc, and .drv.File and directory names are not case-sensitive.

  • The Evolution of Microsoft Windows Early versions presented a graphical user interface (GUI) for MS-DOS.Microsoft Windows 3.11 was the last 16-bit OS and the most well known version.Microsoft Windows 95 was the first 32-bit version.All applications designed for Windows have standard interfaces.Multitasking allows users to have more than one application open.

  • Operating Modes Real mode could address only 1 MB of random access memory (RAM).Standard mode allowed programs to run in protected mode.In protected mode, programs could address up to 16 MB of RAM.386 enhanced mode could address up to 4 GB of RAM.Certain applications included a Windows runtime version.

  • Windows Resource Management

  • Memory Paging and Virtual Machines Virtual memory is an area on the hard disk drive (called a swap file) that the system uses to store program code temporarily.Virtual machines (VMs) allow multiple programs to operate.DOS programs run individually in separate VMs.

  • Windows Operating Systems Microsoft Windows for Workgroups 3.11 is an upgrade to Microsoft Windows 3.1.Windows 95, Microsoft Windows 98, and Microsoft Windows Me can be networked easily.Microsoft Windows NT is designed for networking.Microsoft Windows 2000 replaces Windows NT.Upgrading to Windows NT or Windows 2000 could present compatibility problems with some hardware and applications.

  • The COMMAND Command MS-DOS uses a text-based command-line user interface.A text-based interface requires no drivers because display functions are built in.COMMAND.COM provides the user interface.

  • Working with the Prompt Typing PROMPT /? or HELP PROMPT provides help information.DOS HELP returns information on customizing the prompt and the information that appears.

  • Internal and External Commands External commands exist as separate files.Windows has its own set of system utilities.Internal commands are contained within COMMAND.COM.Command mode requires typing a command instead of clicking an icon.

  • DOS Mode Navigation and File Management The DOS file system uses a tree structure.A fully qualified path is the list of directories from the root to the file.The DIR command displays the contents of the current or a specified directory.DOS does not support Windows long filenames.The MD command creates a new directory.

  • The PATH Command PATH allows you to display and change the search path.%PATH% appends the old path to the new path.Programs in path directories can be run from any location on the computer.

  • Creating a Batch File A batch file is an executable file that runs a series of existing commands or applications.Commands listed in the file are executed in sequence.Any executable that can be run from the prompt can be included in a batch file.

  • Renaming a File The RENAME or REN command allows you to rename a file.The CD command allows you to change directories.The CLS command clears the screen.

  • Using Edit

  • Summary of DOS Terminology

  • CONFIG.SYS Commands BUFFERS COUNTRY DEVICE DEVICEHIGH DOSFCBS FILES INSTALL LASTDRIVEMOUSE.SYS NUMLOCK SHELL SWITCHES

  • AUTOEXEC.BAT Commands DOSKEY ECHO KEYB MOUSE.EXE

    PATH PAUSE PROMPT

    SET SHARE SMARTDRV

  • File System Basics The file system organizes data on the storage medium. Different media require different file systems.File systems define naming conventions, file size, and media capacity.Magnetic media employ several different file systems, depending on the OS.

  • Key File System Terms BlockBoot diskBoot sectorClusterDual bootEncryption

    End-of-file (EOF) markerFileFile allocation table (FAT)File formatFile handleFile locking

    Filename FolderFormatLow-level formatMaster boot recordPartition tablePrimary partitionSectorTrack Volume

  • Comparing and Choosing File Systems Decision factors: Dual boot requirementNumber and size of hard disk drivesSize of partitionsNeed to support legacy applicationsNeed for advanced features such as security

  • FAT-Based File Systems All modern PCs can use FAT.FAT organizes files by listing them in a table.Two copies of the table are maintained on the media.FAT was developed for and is still used by floppy disk drives.There are three versions: FAT12, FAT16, and FAT32.

  • FAT16 and FAT32 Compared and Contrasted High compatibilityUse of MS-DOS bootable floppy diskPerformance advantage on small volumes Manual intervention to use FAT copyNo backup of boot sector 2-GB volume limitBetter performance when operating in real mode or safe mode Dual boot with Windows NT and Windows 98 8.3 filenaming limit Limited compatibilityNo use of MS-DOS bootable floppy diskMore efficient allocation of disk space Automatic use of FAT copy if neededAutomatic backup of boot sector Support of 32-GB volumesFaster load times for applications and large data filesNo dual boot with Windows NT and Windows 98Support of filenames up to 255 characters FAT16FAT32

  • The NT File System (NTFS) Was introduced with Windows NTSupports long filenames and is optimized for multiuser environmentsProvides file and folder level securityIs more reliable than previous file systemsIs not completely supported under Windows NT

  • Advantages and Disadvantages of NTFS Advantages Disadvantages Supports volumes up to 2 terabytes (TB) Maintains a recovery logHas no limit on number of entries at root Allows faster file accessSupports disk quotas (Windows 2000)Supports file and folder compressionSupports file and folder security Does not allow accessing NTFS volumes under MS-DOS, Windows 95, or Windows 98 Does not allow using NTFS volumes as a primary partition for dual booting MS-DOS, Windows 95, or Windows 98Could decrease performance on volumes smaller than 400 MB

  • File System Size Limitations Different OSs handle cluster size differently.Under FAT volumes, drives smaller than 16 MB are formatted as FAT12.MS-DOS, Windows 95, and Windows 98 cannot access FAT16 volumes larger than 2 GB.

  • File System Security FAT attributes on FAT file systems FAT has attributes that can protect files from being overwritten or viewed.Attributes can be set by using the ATTRIB DOS-mode command, or by right-clicking a file in Windows and selecting the Properties option. NTFS file and folder security NTFS uses permissions to determine who can access the file or folder. Permissions are set by using the Security tab for the file or folder.

  • Chapter Summary An OS is the interface between the hardware and the user.All OSs have a user interface, memory, and file management.Technicians need to know how to perform command prompt operations.Technicians who work with older OSs must understand MS-DOS and DOS startup files.Internal and external commands can be used to configure and troubleshoot.FAT32 has several enhancements over FAT16.NTFS supports file and folder security, compression, and disk quotas.

    Explain to students that executing commands from the command line, affects files and folders as viewed from the Windows GUI.Explain that DIR will display the contents of a folder same as double clicking that folder in Windows.Acceptable: FRED.EXE, SYSTEM.INI, FILE1.DOC, DRIVER3.SYS, JANET, CODE33.HUnacceptable: 4CHAREXT.EXEC, WAYTOOLONG.FIL, BAD/CHAR.BAT, .NOWhen DOS was introduced, no programs were available to convert format so that files can be exchanged.Common format was developed that any program could read ASCII (American Standard Code for Information Interchange)ASCII was the first universal file formatAll programs can read simple text files1st floppy is A:, 2nd floppy is B:, hard drive is C:, other optical drives are assigned letters sequentially after the hard driveWin 2000, NT, XP allows you to change the default lettering of dirvesWindows uses hierarchical directory tree to organize contents of drives. Roots and branches2 or more files with the same name can exist in different folder but 2 files in the same folder cannot have the same name. Same for subfolders.

    To focus on the directory TEST under the root directory of the C drive: C:\TESTTo focus on subdirectory SYSTEM: C:\TEST\SYSTEMIf there is a file called TEST2.TXT in SYSTEM subdirectory, location of this file would be C:\TEST\SYSTEM\TEST2.TXTExamples of paths: C:\DOS, F:\FRUSCH3\CLEAR, A:\REPORTS, D:\

    We will examine 4 commands available in all versions of Microsofts command line interface: DIR, CD, MD, RDAlternatively u can use a space instead of \ after CDJump multiple directories C:\>CD FRED\BACKUP\TEST (C:\FRED\BACKUP\TEST>)Go up one level CD..Using DIR, CD, and drive letter commands you can access any folder on any storage device on PCMust delete the files (DEL) and remove subdirectories (RD) before you can remove a directoryDELTREE command deletes the directory as well as all subdirectories and filesGo to C:\WINDOWS\System32Type DIRIdentify file MEM.EXEType MEM and enterHidden files not displayed using DIR commandRead-only file cannot be modified or deletedSystem attribute identifies a a system file e.g. IO.SYSArchive allows back up software to identify files that have been changed since their last backup