Presentation is loading. Please wait.

Presentation is loading. Please wait.

Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 6 Directory Commands.

Similar presentations


Presentation on theme: "Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 6 Directory Commands."— Presentation transcript:

1 Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 6 Directory Commands

2 Guide to Parallel Operating Systems with Windows 7 and Linux Objectives Describe directory structures Display directory structures Navigate directory structures Work with directories Work with file management commands Use removable drives for the storage of application data 2

3 Guide to Parallel Operating Systems with Windows 7 and Linux 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 3

4 Guide to Parallel Operating Systems with Windows 7 and Linux4 Figure 6-1 Campus map Courtesy Course Technology/Cengage Learning

5 Guide to Parallel Operating Systems with Windows 7 and Linux5 Figure 6-2 Departments on campus Courtesy Course Technology/Cengage Learning

6 Guide to Parallel Operating Systems with Windows 7 and Linux Directory Structures (continued) 6 Figure 6-3 Beginning of the Campus directory Courtesy Course Technology/Cengage Learning

7 Guide to Parallel Operating Systems with Windows 7 and Linux7 Figure 6-4 Expanded Campus directory structure Courtesy Course Technology/Cengage Learning

8 Guide to Parallel Operating Systems with Windows 7 and Linux Displaying Directory Structures Displaying directory structures in the Windows 7 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 Windows command prompt to open: –Click Start, pointing to All Programs, click Accessories, and click Command Prompt 8

9 Guide to Parallel Operating Systems with Windows 7 and Linux 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 ” –To include filenames add the /F switch –Use the /A switch to exclude extended characters –Use the pipe symbol (|) to pass the output 9

10 Guide to Parallel Operating Systems with Windows 7 and Linux Displaying Filenames in the Windows 7 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:\Users\User01\Documents\homework.doc 10

11 Guide to Parallel Operating Systems with Windows 7 and Linux Using Wildcard Characters in the Windows 7 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 11

12 Guide to Parallel Operating Systems with Windows 7 and Linux Using Wildcard Characters in the Windows 7 CLI (continued) 12 Table 6-1 Examples of using wildcard characters

13 Guide to Parallel Operating Systems with Windows 7 and Linux 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 operation: –Expand Computer to display available drives Files and folders view options: –Four icon views, List view, Details view, Tiles, Content view 13

14 Guide to Parallel Operating Systems with Windows 7 and Linux14 Figure 6-7 Windows Explorer Courtesy Course Technology/Cengage Learning

15 Guide to Parallel Operating Systems with Windows 7 and Linux Displaying the Directory Structure in Fedora 13 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 Fedora 13: –Might be configured to open command line –Can open a Terminal console from a GUI Home directory is starting directory for regular users –Example: /home/User01 15

16 Guide to Parallel Operating Systems with Windows 7 and Linux Fedora 13 Command Syntax Command [options] [parameter1] [parameter2] [parameter3] ls –l (the l is a lowercase L): –Provides a detailed list of directories, files, and any errors ls –l Documents : –Provides a list of files in the Documents directory 16

17 Guide to Parallel Operating Systems with Windows 7 and Linux Displaying Directories and Files in the Fedora 13 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 useful ls commands: ls –l /etc/hosts : list details about a file/directory ls –iS /etc/hosts : change the order of lines in a text file 17

18 Guide to Parallel Operating Systems with Windows 7 and Linux Displaying Directories and Files in the Fedora 13 CLI (continued) Use more with ls to list hidden and unhidden files –Example: ls –a /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] 18

19 Guide to Parallel Operating Systems with Windows 7 and Linux19 Table 6-2 Long-list column definitions using the ls –l command

20 Guide to Parallel Operating Systems with Windows 7 and Linux Using the tree Command to Display the Directory Structure in the Fedora 13 CLI Tree: –Recursive directory listing program –Produces an indented listing of files tree command: –Shows files in current directory and its subdirectories –Used to list contents of directories in tree-like format When directory information is given: –Tree lists all files and/or subdirectories found in the given directories 20

21 Guide to Parallel Operating Systems with Windows 7 and Linux21 Figure 6-10 Tree-style directory structure in the Fedora 13 CLI Courtesy Course Technology/Cengage Learning

22 Guide to Parallel Operating Systems with Windows 7 and Linux Using Wildcard Characters in the Fedora 13 CLI Uses same wildcard characters as Windows 7 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 22

23 Guide to Parallel Operating Systems with Windows 7 and Linux 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 23

24 Guide to Parallel Operating Systems with Windows 7 and Linux Navigating the Directory Structure in the Windows 7 CLI Working directory: current directory (location) To change 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 relative 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 24

25 Guide to Parallel Operating Systems with Windows 7 and Linux 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 For example: –To make Science the current folder –Click Science in the left pane 25

26 Guide to Parallel Operating Systems with Windows 7 and Linux26 Figure 6-13 Navigating to the Science folder Courtesy Course Technology/Cengage Learning

27 Guide to Parallel Operating Systems with Windows 7 and Linux Navigating Directory Structures in Fedora 13 Use the cd command to change current directory: –Page definition options are beyond scope of book cd command syntax: cd [options] [location path] 27

28 Guide to Parallel Operating Systems with Windows 7 and Linux Using Absolute and Relative Paths in the Fedora 13 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 previous directory using the relative path: –Type cd../../business/accounting Type cd.. –To back up one subdirectory and move up higher 28

29 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Directories Creating directories in the Windows 7 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 29

30 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Directories (continued) 30 Figure 6-14 Using the MD command to make a Physics subdirectory Courtesy Course Technology/Cengage Learning

31 Guide to Parallel Operating Systems with Windows 7 and Linux Creating Directories in the Windows 7 GUI Navigate to the parent folder Science in left pane Click Science Right-click the white space Point to New Click Folder and type “Physics” Press Enter 31

32 Guide to Parallel Operating Systems with Windows 7 and Linux32 Figure 6-15 Creating the Physics directory Courtesy Course Technology/Cengage Learning

33 Guide to Parallel Operating Systems with Windows 7 and Linux Creating Directories in Fedora 13 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 33

34 Guide to Parallel Operating Systems with Windows 7 and Linux Removing Directories in the Windows 7 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 34

35 Guide to Parallel Operating Systems with Windows 7 and Linux Removing Directories in the Windows 7 GUI 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 35

36 Guide to Parallel Operating Systems with Windows 7 and Linux Removing Directories in Fedora 13 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 36

37 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Files To keep your files up to date: –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 37

38 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Files in the Windows 7 CLI Copying files in the Windows 7 CLI –COPY command: copies files to alternative location –XCOPY : a more powerful version of COPY 38

39 Guide to Parallel Operating Systems with Windows 7 and Linux Using the COPY Command in the Windows 7 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 About the /V switch: –Used to verify that data has been accurately recorded –Slows down COPY as OS must check all disk sectors 39

40 Guide to Parallel Operating Systems with Windows 7 and Linux Using the XCOPY Command in the Windows 7 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 40

41 Guide to Parallel Operating Systems with Windows 7 and Linux Moving Files in the Windows 7 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 MOVE similar to COPY with one exception: –Source file is always removed from the disk Rename the Dental subdirectory to Dental Assistant: MOVE \User01\College\Technology\Dental \User01\College\Technology\Dental Assistant 41

42 Guide to Parallel Operating Systems with Windows 7 and Linux Renaming Files in the Windows 7 CLI RENAME command syntax for renaming files: –RENAME [drive:][path]filename1 filename2 REN command syntax for renaming files: –REN [drive:][path]filename1 filename2 Renaming the Budget.xls file: –Type 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 42

43 Guide to Parallel Operating Systems with Windows 7 and Linux Deleting Files in the Windows 7 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 To remove the homework.doc file: –DEL \User01\homework.doc 43

44 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Files in the Windows 7 GUI Copying files in the Windows 7 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 44

45 Guide to Parallel Operating Systems with Windows 7 and Linux Moving Files in the Windows 7 GUI Similar to copying files in Windows Explorer Example: to 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 45

46 Guide to Parallel Operating Systems with Windows 7 and Linux Renaming Files in the Windows 7 GUI Example: to 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 46

47 Guide to Parallel Operating Systems with Windows 7 and Linux Deleting Files in the Windows 7 GUI Example: to 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 47

48 Guide to Parallel Operating Systems with Windows 7 and Linux Working with Files in Fedora 13 Copying files in the Fedora 13 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 –To copy a branch with deep, nested directories: cp -r /college/science/chemistry/* /college/arts/ 48

49 Guide to Parallel Operating Systems with Windows 7 and Linux Moving Files in the Fedora 13 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 but is used in interactive processing -v : displays command activity as it occurs mv similar to cp with one exception: –The source file is always removed from its directory 49

50 Guide to Parallel Operating Systems with Windows 7 and Linux Renaming the Files in the Fedora 13 CLI Use the mv command To change Dental Department to Dental Assistant: –Type mv /User01/college/technology/dental /User01/college/technology/dental assistant Use quotes to enclose filenames with spaces 50

51 Guide to Parallel Operating Systems with Windows 7 and Linux Deleting Files in the Fedora 13 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 To remove all of the.doc files from /User01: –Type rm /mnt/sdb1/User01/* 51

52 Guide to Parallel Operating Systems with Windows 7 and Linux Using Removable Drives for Application Data Storage Using Removable Drives in the Windows 7 CLI –Format disk before use: To remove any existing files To improve the odds that the USB drive will accept new files without write errors –After formatting disk: You can copy the files from the hard drive 52

53 Guide to Parallel Operating Systems with Windows 7 and Linux Formatting Removable Drives in the Windows 7 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 To format a USB drive as the H drive: –Type FORMAT H : and press Enter Specify up to 11 volumes using the /V switch Use the /Q switch to perform a quick format 53

54 Guide to Parallel Operating Systems with Windows 7 and Linux Copying Files to a Removable Drive in the Windows 7 CLI Copy files to formatted disk with COPY or XCOPY To copy the homework.doc file: –Navigate to the subdirectory that contains the file –Enter the command COPY homework.doc H : 54

55 Guide to Parallel Operating Systems with Windows 7 and Linux Using Removable Drives in the Windows 7 GUI Formatting removable drives in the Windows 7 GUI: –To format a USB drive: Place it in the USB port From Windows Explorer, right-click the USB option and then click Format Format USB dialog box appears Click the Quick Format check box Click the Start button to start the format 55

56 Guide to Parallel Operating Systems with Windows 7 and Linux Using Removable Drives in the Windows 7 GUI (continued) Copying files to a Disk in the Windows 7 GUI –Windows Explorer: Can copy files to a formatted disk Storing files from an application –Click File ->Save As –Click the Save in list box, click the USB drive –Type filename then click Save 56

57 Guide to Parallel Operating Systems with Windows 7 and Linux Using Removable Drives in the Fedora 13 CLI To prepare a disk for use: –Unmount the disk and format it –Mount the disk drive and copy files from hard drive Formatting removable drives in the Fedora 13 CLI: –Use floppy command to format removable drives –Syntax: floppy [options] [target device] 57

58 Guide to Parallel Operating Systems with Windows 7 and Linux Using Removable Drives in the Fedora 13 CLI (continued) Formatting removable drives in the Fedora 13 CLI (continued): –Some options used with floppy command: probe, -p : probes for available floppy drives -format, -f : formats the disk in the floppy drive Copying files to a removable drive in the Fedora 13 CLI –To copy a file called homework.doc: Navigate to subdirectory that contains file, then use cp homework.doc /dev/fd0 or cp homework.doc /dev/sda0 58

59 Guide to Parallel Operating Systems with Windows 7 and Linux Summary Use directory structures to: –Organize and maintain information in files and folders Use a command-line interface (CLI): –To help you display the contents of a directory To manage the directory structure: –Create new directories to categorize folder information –Remove directories that are obsolete When you navigate directory structures: –Each operating system has its own syntax 59

60 Guide to Parallel Operating Systems with Windows 7 and Linux Summary (continued) When navigating the absolute path: –Provide the drive and the full path name When navigating with a relative path: –The current directory path is implied Use a command prompt or a GUI to: –Copy, move, rename, and delete files Removable drives: –Provide portability for file management and processing 60


Download ppt "Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 6 Directory Commands."

Similar presentations


Ads by Google