Download presentation
Presentation is loading. Please wait.
Published byTamsyn Crystal Marshall Modified over 8 years ago
1
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 4 Directory Commands
2
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux2 Objectives Describe directory structures Display directory structures Navigate directory structures Work with directories
3
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux3 Objectives (continued) Work with file management commands Use removable drives for the storage of application data
4
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux4 Directory Commands Directory structures are key to file system technology Learning to navigate directories is important –Provides insight into organizing files on your PC Chapter goals –Use various directory commands –Use various techniques to work with directories –Learn file management techniques Keep your directory structures up to date –Learn to use floppy drives and other removable drives Use new skills to store and transport data
5
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux5 Directory Structures Scenario: organize five buildings on a campus map Problem 1: adding departments creates clutter Problem 2: adding course information not possible Solution: organize campus information in a directory Creating a directory structure –Begin with “Campus” as the main directory –Add buildings in alphabetical order –Place the departments with the correct building Directories can be manipulated with various tools
6
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux6 Directory Structures (continued)
7
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux7 Directory Structures (continued)
8
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux8 Displaying Directory Structures Directory structures (trees): used to organize files Operations performed on directory structures –Display the structure –Change your focal point –Display file names in the directory structure
9
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux9 Displaying Directory Structures in the Windows XP CLI Using the command-line interface (CLI) –User types a command at a visual (command) prompt –OS sends back a response –Two-way interaction continues as long as needed Use TREE or DIR command to view a directory Option for locating a single file or a set of files –Specify which characters your search must match
10
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux10 Windows Command-Line Interpreter Accepts commands and performs specified tasks Two consoles: cmd.exe, Command.com –Command.com retained for backward compatibility Two ways to open the cmd.exe console –Click Start -> Run, type cmd, press Enter –Click Start -> All Programs-> Accessories-> Command Prompt Windows XP relationship to DOS –Windows XP does not run on a DOS sublayer –Windows XP emulates the DOS environment
11
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux11 Using the TREE Command to Display the Directory Structure TREE: creates graphical view of disk directories –Shows current directory and all subdirectories below Command syntax: TREE [drive:][path] [/F] [/A] –/F: displays filenames in each folder –/A: uses ASCII characters (not extended characters) Example: “TREE C:\Documents and Settings\ User01\My Documents” –Paths with long filenames may be enclosed by quotes Long filenames can have more than 200 characters
12
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux12 Displaying Filenames in the Windows XP CLI DIR command: displays filenames and subdirectories Syntax: DIR [drive:][path][filename] [/O[[:]sortorder]] [/P] [/S] [/W] –[drive:][path][filename]: specifies drive, directory, files –/O: lists files in sorted order –sortorder: followed by one of six values: N, S, E, D, G,- –/P: pauses after each screen of information –/S: shows files in specified directory and subdirectories –/W: uses wide list format Example: DIR "C:\Documents and Settings\User01\ My Documents\homework.doc"
13
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux13 Using Wildcard Characters in the Windows XP CLI Two wildcard characters identify groups of files –The question mark (?): represents any character –The asterisk (*), or star: represents any string Using the ? wildcard in DIR mem???.txt –Lists files named in form “mem” + three characters –Valid matches: memo.txt, memory.txt, mem49.txt Using the * wildcard in DIR *.DOC –Lists all files in current directory with.DOC extension
14
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux14 Using Wildcard Characters in the Windows XP CLI (continued)
15
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux15 Displaying the Directory Structure with Windows Explorer Windows Explorer is a graphic user interface Two panes used in layout of Windows Explorer –Left pane displays the directory structure of drives –Right pane displays the structure of selected entry Basic operations –Expand My Computer to display available drives –Expand a drive to see structure in fine detail Six options for arranging files –Thumbnails, Tiles, Filmstrip, Icons, List, Details
16
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux16 Displaying the Directory Structure with Windows Explorer (continued)
17
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux17 Displaying the Directory Structure in Fedora Core 4 Directories and files are organized hierarchically Ability to manipulate directory defined by rights –Superuser: arranges information anywhere –Regular user: is confined to a particular branch Accessing the Fedora Core 4 command-line interface –Configure the system to open to the command line –Open a terminal window from the GUI Home directory is starting directory for regular users –Example: /home/User01
18
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux18 Fedora Core 4 Command Syntax Command [options] [parameter1] [parameter2] [parameter3] Executed command produces three data streams –stdin (input) –stdout (output) –stderr (error) Data streams for ls -l, a sample command –Current directory is the stdin –Detailed long listing is the stdout –Resulting errors are the stderr Commands may be used conjointly
19
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux19 Fedora Core 4 Command Syntax (continued) Three methods for executing commands –Same line, sequential command-line processing Example: ls –l /etc ; pwd –Piped, sequential command processing Example: ls –l /etc | more Pipe symbol pipes output from ls to more –Batch file sequential processing Example: ls –l /etc pwd Commands saved for later execution as a batch file
20
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux20 Displaying Directories and Files in the Fedora Core 4 CLI Use ls command to view list of directories and files ls default: display directory with files alpha sorted ls command syntax: ls [options] [location] Some ls command options –-a: shows hidden files –-l: a long-listing format A few examples of many useful ls command options –ls –l /etc/hosts: list details about a file or directory –ls –S /etc/hosts: change the order of lines in a text file
21
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux21 Displaying Directories and Files in the Fedora Core 4 CLI (continued) Use more with ls to page through directories/files –Example: ls –Rl /etc | more Use sort with ls to control order item appears in list –Example: ls –l /etc | sort –k9 (sort by ninth field in list) sort command syntax: sort [options] [files] pwd command syntax: pwd [options] –Displays full path filename of the current directory more command syntax: more [options]
22
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux22 Using Wildcard Characters in the Fedora Core 4 CLI Uses same wildcard characters as Windows XP Two wildcard characters identify groups of files –The question mark (?): represents any character –The asterisk (*), or star: represents any string Example with ? wildcard: ls host???? –Lists files consisting of host plus any four characters –Possible matches: hostuser, hosthome, host1234 Example using * wildcard: *.* –Represents all filenames with any extension
23
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux23 Navigating the Directory Structure Analogize operation to climbing a tree –Before climbing, look up and view the limbs –Climb the limbs, move to smaller limbs, retrace steps Discussion of navigation techniques to follow
24
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux24 Navigating the Directory Structure in the Windows XP CLI Working directory: current directory (location) Commands changing current directory: CHDIR, CD Syntax of CD command: CD [/D] [drive:][path] Three choices used with the CD command –CD..: backs up one subdirectory –CD path: changes to the current location –CD \path: changes to the absolute location Scenario: change relative location of E:\User01 –Enter CD College at the command prompt –Command prompt changes to E:\User01\College>
25
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux25 Navigating the Directory Structure in the Windows XP CLI (continued)
26
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux26 Navigating Directory Structures in Windows Explorer Navigating directories in Windows Explorer –Click a folder in the left pane of Windows Explorer –The location changes, the right pane is refreshed Changing E:\User01\College to Science –Click Science in the left pane
27
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux27 Navigating Directory Structures in Windows Explorer (continued)
28
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux28 Navigating Directory Structures in Fedora Core 4 Use the cd command to change current directory –Page definition options are beyond scope of book cd command syntax: cd [options] [location path]
29
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux29 Using Absolute and Relative Paths in the Fedora Core 4 CLI Two methods: change absolute path or relative path Other directory symbols –“.” entry: points to the current directory –“..” entry: points to the parent directory Change the directory with the absolute path method –Type cd /college/business/accounting Refer to the previous directory using the relative path –Type cd../../business/accounting Back up one subdirectory and move up higher –Type cd..
30
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux30 Working with Directories Directories accommodate changing storage needs Two ways to alter directory structure –Create new directories –Remove directories
31
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux31 Creating Directories in the Windows XP CLI Use MD or MKDIR to create a subdirectory MD command syntax: MD [drive:]path MD interprets drive and path like CD –MD path - creates subdirectory in a relative location –MD \path - creates subdirectory in absolute location Creating Physics subdirectory relative to Science –Navigate to Science with the CD command –Type MD Physics (relative path method) or –Type MD "\User01\College\Science\Physics"
32
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux32 Creating Directories in the Windows XP CLI (continued)
33
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux33 Creating Directories in the Windows XP GUI Navigate to the parent folder Science in left pane Right-click the white space Point to New, as shown in Figure 4-12 Click Folder and type “Physics” Press Enter
34
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux34 Creating Directories in the Windows XP GUI (continued)
35
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux35 Creating Directories in Fedora Core 4 Users authorized to create directories with mkdir –Superuser –Regular user with write permission in parent directory mkdir syntax: mkdir [options] [directory name] mkdir command options: –-p: makes parent directories as needed –-v: displays a message for each created directory Navigating to arts directory, adding printing directory –cd /college/arts mkdir printing
36
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux36 Removing Directories in the Windows XP CLI Use RMDIR or RD (remove directory) command RD command syntax: RD [/S] [/Q] [drive:]path –/S: removes directories and files in specified location –/Q: quiet mode (confirmation not requested) Two choices for removing a directory –RD path: removal relative from current location –RD \path: removal absolute from current location Removing the Science directory –Type RD /S \User01\College\Science –Press Enter and then type ‘Y’ to confirm
37
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux37 Removing Directories in the Windows XP CLI (continued)
38
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux38 Removing Directories in the Windows XP GUI How to remove a directory –Navigate to target folder and right-click –Click Delete –Confirm choice by clicking the Yes button Removing the Music folder –Right-click Music in the right pane –Click Delete, and then confirm the deletion A deleted item is placed in the Recycle Bin –Items can be restored or permanently deleted
39
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux39 Removing Directories in the Windows XP GUI (continued)
40
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux40 Removing Directories in Fedora Core 4 Ownership permission or superuser logon required rmdir command syntax: rmdir [options] directory[s] rmdir command options: –-p: tries to remove components in path as needed Cannot be used if directories contain files –-v: displays a message for each removed directory Navigate to Printing directory, remove component –cd /college/arts rmdir printing Remove full branch with rm command and -r or -R Removing Directories in Fedora Core 4
41
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux41 Working with Files Copy one or more files to an alternative location Move files or directories to another folder or drive Rename files and directories Delete files from the computer
42
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux42 Copying Files in the Windows XP CLI COPY command: copy files to alternative location XCOPY: a more powerful version of COPY
43
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux43 Using the COPY Command in the Windows XP CLI Command syntax: COPY [/V] source [destination] –source: specifies the file(s) to be copied –destination: specifies target directory and/or filename –/V: verifies that new files are written correctly Copy Budget.xls from \Science to \Science\Chemistry –Enter COPY \Science\Budget.xls \Science\Chemistry About the /V switch –Used to verify that data has been accurately recorded –Slows down COPY as OS must check all disk sectors
44
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux44 Using the XCOPY Command in the Windows XP CLI Similar to COPY command, but has more switches Use XCOPY command to: –Copy files in bulk from one directory or drive to another –Copy whole directories to a new destination XCOPY syntax: XCOPY source [destination] [/P] [/S] [/E] [/V] [/Q] [/F] [/L] Making a backup of College subdirectories and files –XCOPY /S \User01\College \User01\Backup –/S option excludes empty directories from operation –Target (User01\Backup) specifies a directory (D)
45
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux45 Moving Files in the Windows XP CLI Command syntax for moving files –MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination Command syntax for renaming a directory –MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 Similar to copying files with two exceptions –Source file is always removed from the disk –Command syntax requires a target destination Rename the Dental subdirectory to Dental Assistant –MOVE \User01\College\Technology\Dental "\User01\College\Technology\Dental Assistant"
46
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux46 Renaming Files in the Windows XP CLI RENAME command syntax for renaming files –RENAME [drive:][path]filename1 filename2 REN command syntax for renaming files –REN [drive:][path]filename1 filename2 Destination file must reside on same drive and path Renaming the Budget.xls file –Enter REN Budget.xls Budget2006.xls Wildcards (* and ?) used to change set of filenames –Restriction: old and new name lengths stay the same –Change “.txt” extension to “.bak”: REN *.txt *.bak
47
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux47 Deleting Files in the Windows XP CLI DEL syntax: DEL [/P] [/S] [/Q] names ERASE syntax: ERASE [/P] [/S] [/Q] names Options for both commands –/P: prompts for confirmation before deleting each file –/S: deletes specified files from all subdirectories –/Q: operates in quiet mode Delete one or more files using DEL command Removing Homework.doc file –DEL \User01\Homework.doc
48
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux48 Working with Files in the Windows XP GUI Use the Windows Explorer to work with files –Right pane displays important file information File operations –Copy –Move –Rename –Delete
49
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux49 Copying Files in the Windows XP GUI Example: copying the homework.doc file –Navigate to the subdirectory that contains the file –Right-click homework.doc –Click Copy –Navigate to the new location in the left pane –Right-click the white space of the right pane –Click Paste
50
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux50 Copying Files in the Windows XP GUI (continued)
51
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux51 Moving Files in the Windows XP GUI Similar to copying files in Windows Explorer Example: move the homework.doc file –Navigate to the subdirectory that contains the file –Right-click homework.doc –Click Cut –Navigate to the new location in the left pane –Right-click the white space of the right pane –Click Paste
52
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux52 Renaming Files in the Windows XP GUI Example: Rename the homework.doc file –Navigate to the subdirectory that contains the file –Right-click homework.doc –Click Rename –Type a new name over homework.doc –Press Enter to save the name Attempt to change extension generates warning –Enter Yes to indicate that new extension is acceptable
53
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux53 Renaming Files in the Windows XP GUI (continued)
54
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux54 Deleting Files in the Windows XP GUI Example: delete the homework.doc file –Navigate to the subdirectory that contains the file –Right-click homework.doc –Click Delete –Confirm File Delete message generated To delete the file, click the Yes button
55
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux55 Copying Files in the Fedora Core 4 CLI Three variations on the cp command syntax –cp [options] [source path] [target path] –cp [options] [source path] [target directory] –cp [options] [source directory] [target directory] Some cp command options –-l: links files instead of copying them –-R or -r: copies directories recursively –-s: makes symbolic links instead of copying files Copying a branch with deep, nested directories –cp -r /college/science/chemistry/* /college/arts/
56
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux56 Moving Files in the Fedora Core 4 CLI Two variations on the command syntax –mv [options] [source] [target] –mv [options] [source] [target directory] Command options –-f: displays a prompt before overwriting –-i: also displays a prompt before overwriting –-v: displays command activity as it occurs mv similar to cp with two exceptions –The source file is always removed from its directory –You must always enter a target destination
57
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux57 Renaming the Files in the Fedora Core 4 CLI Use the mv command Change Dental Department to Dental Assistant –Enter mv /User01/college/technology/dental "/User01/college/technology/dental assistant“ Use quotes to enclose filenames with spaces
58
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux58 Deleting Files in the Fedora Core 4 CLI Use the rm command to delete one or more files rm command syntax: rm [options] file[s] rm command options –-i: prompts before any removal –-R or -r: removes contents of directories recursively –-v: displays command activity as it occurs Removing all of the.doc files from /User01 –Enter rm /User01/*
59
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux59 Using Removable Drives For Application Data Storage Use removable drives to store and transport data –Example 1: submit homework on floppy disks –Example 2: store large quantity of data in USB drives Steps for preparing disk and USB drives are similar
60
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux60 Formatting Removable Drives in the Windows XP CLI FORMAT syntax: FORMAT volume [/V:label] [/Q] –volume: specifies drive letter (followed by a colon) –/V:label: specifies the volume label –/Q: performs a quick format Formatting a disk in drive A –Type FORMAT A –Press Enter Specify up to 11 volumes using the /V switch Use the /Q switch to perform a quick format
61
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux61 Copying Files to a Removable Drive in the Windows XP CLI Copy files to formatted disk with COPY or XCOPY Copying the homework.doc file –Navigate to the subdirectory that contains the file –Enter the command COPY homework.doc a:
62
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux62 Using Removable Drives in the Windows XP GUI Formatting a disk –Place disk in floppy drive –From Windows Explorer, right-click 3 1⁄2 Floppy (A:) Click the Quick Format check box, if the disk is good –Click the Start button to start the format Copying files to disk –Once disk is formatted, use standard procedures Storing files from an application –Click File ->Save As –Change drive letter and path in Save in list box –Type filename in textbox and save
63
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux63 Using Removable Drives in the Windows XP GUI (continued)
64
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux64 Using Removable Drives in the Fedora Core 4 CLI Preparing a disk for use –Unmount the disk and format it –Mount the disk drive and copy files from hard drive Use floppy command to format removable drives floppy syntax: floppy [options] [target device] Some options used with floppy command –probe, -p: probes for available floppy drives –--format, -f: formats the disk in the floppy drive Copy files to formatted disk using the cp command
65
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux65 Summary Directory structures (trees) organize files and folders Current location: current or working directory Directories in XP and Fedora Core 4 are similar Display directory with a command-line interface or GUI Wildcards, such as * and ?, help identify sets of files
66
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux66 Summary (continued) Directory structure operations: create and remove Absolute path includes the drive and full path name Relative path includes the drive, implies current directory File operations: copy, move, rename, delete Floppy disks must be formatted before use
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.