Upload
charla-hudson
View
224
Download
2
Embed Size (px)
Citation preview
Common DOS Commands
Additional information
Important DOS ConceptsCommon DOS Commands
Why format a disk?Partitioning and Formatting disksStructure of a disk
Physical structure of a diskLogical structure of a diskFile System Formats
Backing up FilesOverwriting FilesMaking Exact Copies of Files
Chapter 2 adds (42 slides) CTEC 110 2
Important DOS CommandsCommon DOS Commands
FORMAT LABEL VOL MOVE DIR CHKDSK TYPE COPY DEL RENAME
Chapter 2 adds (42 slides) CTEC 110 3
Why Format a Disk?
Disks used for:Permanent storage of data and programsDistributing data from one computer to anotherMaking copies
Formatting (initializing) the disk:Process of preparing disk so that it is compatible
with an operating systemAll disks (including hard disks) can be formatted.All information on disk will be erased
CTEC 110 4Chapter 2 adds (42 slides)
Partitioning and Formatting Disks
Hard disks must be: Partitioned Formatted with file system
Types of disk storage configuration: Basic disks Dynamic disks
CTEC 110 5Chapter 2 adds (42 slides)
Partitioning and Formatting Disks
Windows supports four file systems:NTFSPlus three FAT file systems
– FAT12– FAT16– FAT32
CTEC 110 6Chapter 2 adds (42 slides)
Structure of a Disk Two parts to formatting a disk:
Low-level (physical) formatting High level (logical) formatting
Low-level (physical) formatting: Sequentially numbers tracks and sectors Identifies each track and sector Disk is physically prepared to hold data
High-level (logical) formatting: Determines how OS uses a disk Builds structure to keep track of location of files Done so files can be stored and retrieved.
CTEC 110 7Chapter 2 adds (42 slides)
Structure of a Disk
Windows will monitor the status of all
data sectors
One or more sectors are combined into logical units called clusters or allocation units
CTEC 110 8Chapter 2 adds (42 slides)
Physical StructureTrack, Sector, & Cluster
CTEC 110 9Chapter 2 adds (42 slides)
Logical StructureMaster Boot Record & Boot SectorMaster boot record (MBR):
First part of hard diskLocates bootable partition of hard disk and gives
control over to it
Boot sector:First sector on logical driveHas table of drive’s characteristicsHas bootstrap loader programAll disks (including non-system disks) have a
boot sector.
CTEC 110 10Chapter 2 adds (42 slides)
Logical Structure
CTEC 110 11Chapter 2 adds (42 slides)
Logical StructureFAT and the Root Directory
FAT tracks “where” data is on the diskFAT – File Allocation Table
A table that tracks the physical clusters
Root directory tracks “what” is on the disk.Root Directory:
A table that tracks file information
CTEC 110 12Chapter 2 adds (42 slides)
File System FormatsFAT16, VFAT & FAT32
FAT essential for:Managing dataFollowing trail of clusters that make up a file
VFAT maintainsbackwards compatibility andaccommodates long file names
FAT32:Enhancement of FAT file system Introduced to overcome limitations of VFAT
CTEC 110 13Chapter 2 adds (42 slides)
FAT32
FAT32:Movable Root Directory
• Can be located anywhere on hard disk
NOTE: For disk security, performance, and efficiency use the NTFS file system
CTEC 110 14Chapter 2 adds (42 slides)
NTFS
Advantages of NTFS: Secure file system Efficient storage of data Faster file access Better data recovery Can compress files/assign disk quotas Encryption of files
CTEC 110 15Chapter 2 adds (42 slides)
NTFS
NTFS: Uses FAT cluster scheme for allocating data.Has less overhead.
CTEC 110 16Chapter 2 adds (42 slides)
Master File Table (MFT)
Master File Table (MFT):
Database of all files in systemUsed by NTFS to track all files and directories
in a volumeDynamicMFT is different from FAT.
CTEC 110 17Chapter 2 adds (42 slides)
File System Format Notes
You can convert FAT to FAT32/NTFS
You CANNOT convert FAT32/NTFS to FAT
Make use of the NTFS file system for disk security, performance, and efficiency
CTEC 110 18Chapter 2 adds (42 slides)
Backing Up Files
Application programs can usually be reinstalled from original disks.
You may want to take snapshots or backup the configuration of your programs for quicker recovery
Always keep track of any special licensing tricks you need to do
19Chapter 2 adds (42 slides) CTEC 110
DOS has three ways to back up data files:
DISKCOPY – (floppy drives)COPYXCOPY
20Chapter 2 adds (42 slides) CTEC 110
Backing Up Files
Develop a regular backup routine.You can use “tape backup”You can use writable CDsYou can use “external drives”
21Chapter 2 adds (42 slides) CTEC 110
Backing Up Files
Notes on the Backup diskKeep currentHave two or moreCheck your backups with restore regularly
Some organizations need to recreate recordsNeed archival backupNeed transaction history
22Chapter 2 adds (42 slides) CTEC 110
Backing Up Files
Do regular backups:Back up files that have changed or are new
Reasons for copying files:Copy files from one disk to anotherMaking changes on existing fileCreate backup copy of various data files
23Chapter 2 adds (42 slides) CTEC 110
Backing Up Files
Overwriting Files
The file must have a unique name on same disk and subdirectory
Old data replaced by new dataOverwrite files on regular basis as you
want to backup filesWindows will inform the user that an
overwrite will occur
24Chapter 2 adds (42 slides) CTEC 110
Concatenation is creating another file by combining the contents of two or more text (ASCII) files
Concatenation should never be done with program files, or with data files generated by programs
To avoid accidental concatenation of files, read all messages DOS displays on the screen
COPY FILE1 + FILE2 NEWFILECOPY *.TXT ALLFILES
25Chapter 2 adds (42 slides) CTEC 110
Overwriting Files
Exact Copy of Files
You can have two files with identical contents on same disk
However there are some restrictions…For the same name
• Use different subdirectories
For the same subdirectory• Use different file names
26Chapter 2 adds (42 slides) CTEC 110
A Review on Some Commands
CTEC 110 27
FORMAT formats driveLABEL labels driveVOL list volume label on driveCOPY copies filesXCOPY copies filesTYPE display the contents of filesDEL deletes filesREN rename filesMOVE move filesDATE set the dateTIME set the timeUNDELETE undelete a file
Chapter 2 adds (42 slides)
The FORMAT command
The FORMAT command syntax:FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X] [/P:passes] [/S:state]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]
FORMAT volume [/V:label] [/Q] [/P:passes]
FORMAT volume [/Q]
Chapter 2 adds (42 slides) CTEC 110 28
Use /V: switch for the volume label• No spaces between the colon and label
Use /Q switch for a quick format• Fast way to clear previously formatted disks• Works like the usual FORMAT command• Skips low level formatting• Clears the FAT and root tables• Does not check for bad sectors
Examples: FORMAT A: /V:FLOPPY1 FORMAT C: /Q FORMAT Z: /FS:FAT FORMAT U: /FS:FAT32
CTEC 110 29Chapter 2 adds (42 slides)
The FORMAT command
The LABEL Command
The LABEL command syntax:LABEL [drive:] [label]
Creates, changes or deletes the volume label of a disk
Example:LABEL A: OLDNAMELABEL A: NEWNAMELABEL A:
Input volume label - Up to 11 characters.Press ENTER only to delete label.
CTEC 110 30Chapter 2 adds (42 slides)
The VOL Command
The VOL command syntax:VOL [drive:]
Displays the disk volume label, if any
Example:VOL Z:
Volume in drive Z is USB_DISK_02Volume Serial Number is 64B8-54F3
CTEC 110 31Chapter 2 adds (42 slides)
The COPY Command
The COPY command syntax:COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]]
Copies one or more files to another locationCan be used to combine file contents
Examples:copy c:\Windows\System32\cmd.exe c:\
32Chapter 2 adds (42 slides) CTEC 110
The XCOPY Command
The XCOPY command syntax:XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]
[/EXCLUDE:file1[+file2][+file3]...]
Has the capability of moving files, directories, and even whole drives from one location to anotherThe /S switch copies subdirectories and filesThe /E switch copies empty subdirectories
Examples:XCOPY c: a: /sXCOPY n:\*.* o:\ /e
Chapter 2 adds (42 slides) CTEC 110 33
The TYPE Command
The TYPE command syntax:TYPE [drive:] [path] filename
Internal commandOpens/displays contents of file on screenMust be a text/ASCII file for the display to be meaningful and readable
Example:TYPE z:\ctec110\breakusb.batTYPE o:\name.bat
34Chapter 2 adds (42 slides) CTEC 110
The DEL Command The DEL command syntax:
DEL [/P] [/F] [/S] [/Q] [/A [[:] attributes]] [drive:] [path] filenameERASE [/P] [/F] [/S] [/Q] [/A [[:] attributes]] [drive:] [path] filename
Used to remove files from the disk Files are generally not recoverable The /P switch will ask to confirm deletion The /S switch will delete files in the subdirectories
Examples: DEL TEST.TXT DEL /p c:\Part* DEL /s p:\*.* (Directories will require confirmation)
35Chapter 2 adds (42 slides) CTEC 110
The RENAME command
The RENAME command syntax:RENAME [drive:][path]filename1 filename2REN [drive:][path]filename1 filename2
Renames a file or filesYou cannot specify a new drive or path for your destination file
Examples:REN test testingREN testing test
36Chapter 2 adds (42 slides) CTEC 110
The MOVE command
The MOVE command syntax:MOVE [/Y | /-Y] [drive:][path]filename1[,...] destinationMOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
Can be used to rename a file or directory
Examples:move c:\windows\web c:\web2move c:\web2 c:\web3
Chapter 2 adds (42 slides) 37CTEC 110
There are some restrictions…
When moving group of files you cannot change the names
When moving an individual file/subdirectory you can change the name
You can move files/directories from one directory to another and from one drive to another
38Chapter 2 adds (42 slides) CTEC 110
The MOVE command
The DATE command The DATE command syntax:
DATE [/T | date]
Displays or sets the dateRequires Administrator rights to changeType DATE without parameters to display the current date setting and to prompt for a new one
• Press ENTER to keep the same dateUse /T switch to skip the prompting for a new date
Examples:DATEDATE /TDATE 05-22-13 (Set the date to May 22nd, 2013)DATE 05.22.13DATE 05/22/13
39Chapter 2 adds (42 slides) CTEC 110
The TIME command The TIME command syntax:
TIME [/T | time]
Displays or sets the system timeRequires Administrator rights to changeType TIME with no parameters to display the current time setting and a prompt for a new one
• Press ENTER to keep the same timeUse /T switch to skip the prompting for a new time
Examples:TIME TIME /TTIME 15:22 (Set the time to 3:22 pm)
40Chapter 2 adds (42 slides) CTEC 110
The UNDELETE command The UNDELETE command syntax:
UNDELETE [d:][path][filename] [/DT|/DS|/DOS]UNDELETE [/list|/all|/purge[d:]|/status|/load|/U|/S[d:]|/Td:[-entries]]
Has been removed from current Windows OS versionsRestores files deleted with the DELETE commandRemoves the first character of the fileRequires user to supply first character of the file upon undelete
Examples:UNDELETE \letters\*.* /all
• (Recover all files in the letters directory)
UNDELETE /dt • (Recover files in current directory using the delete-tracking file)
41Chapter 2 adds (42 slides) CTEC 110
END of Addition Information
HOMEWORK
Lab 2DOS Quiz 2
Chapter 2 adds (42 slides) CTEC 110 42