Presentation is loading. Please wait.

Presentation is loading. Please wait.

Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 5 Files and File Attributes.

Similar presentations


Presentation on theme: "Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 5 Files and File Attributes."— Presentation transcript:

1 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 5 Files and File Attributes

2 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux2 Objectives Describe the contents of files and name the application that created a particular file Describe the use of file attributes Find files based on name or content

3 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux3 Files and File Attributes General file handling topics –Identifying a file’s contents –Determining which application can edit a file –Using a file’s attributes to access files –Searching files by filenames or contents

4 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux4 Contents Of Files File: discrete set of information OS stores program modules in file systems Save documents under filenames for future use Section learning goals –Recognizing the contents of files –Recognizing actions a given OS takes to open a file

5 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux5 Contents of Files in Windows XP Filename: name plus “.” plus extension –Examples: requirements.htm, requirments.html Two types of extensions –Short extension is three characters (older convention) –Long extension exceeds three characters Extensions indicate the type of data stored in a file Windows XP appends extension to filename prefix

6 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux6 Viewing File Extensions in Windows XP Windows tracks the extensions your PC uses Viewing registered file extensions –Click Start-> Control Panel -> Folder Options -> Files –Next, click the File Types tab –Example: MS Word documents have.doc extension Administrative rights required to modify extensions

7 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux7 Viewing File Extensions in Windows XP (continued)

8 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux8 File Associations XP identifies file associations by extension File association partly determines OS handling –Which icon appears for a file in Windows Explorer –Which commands appear in a file’s shortcut menu –Which application opens if a user double-clicks a file

9 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux9 Icon Appearance in Windows Explorer File icon displayed is associated with the file’s type Set icons using File Types tab in Folder Options Changing a file icon –Go to Folder Options dialog box –Click the Advanced button on the File Types tab –Click the Change Icon button –Choose a new icon from the list

10 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux10 Icon Appearance in Windows Explorer (continued)

11 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux11 Commands in a File’s Shortcut Menu Right-click a file icon to view a shortcut menu Choices appearing on all file shortcut menus –Create a shortcut –Delete a file –Rename a file –View file properties Some shortcut menu items are object specific –Example: Open and Print are used in MS WordPad Bold items identify default response to double-click

12 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux12 Commands in a File’s Shortcut Menu (continued)

13 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux13 Opening Applications Default response to double-clicking a file icon –Windows XP opens file in associated application Example: response to double-clicking Document.doc –OS opens the file In WordPad WordPad is associated with.doc files Default action in Folder Options is defined as Open Changing the default action –Go to Folder Options dialog box –Select the file type you want –Click the Advanced button on the File Types tab –Choose new action (if available) in Actions list

14 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux14 Opening Applications (continued)

15 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux15 Applications in Windows XP Learn common extensions to quickly assess files Situations that show the value of knowing extensions –Evaluate file attached to e-mail before opening –View files on USB drive, infer application association Table 5-1 lists some common file extensions – Use the information to determine if you can edit a file Table 5-2 identifies programming source files

16 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux16 Applications in Windows XP (continued)

17 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux17 Applications in Windows XP (continued)

18 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux18 Applications in Windows XP (continued)

19 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux19 Applications in Windows XP (continued) Table 5-3 lists common Internet file extensions –Use information to troubleshoot browser problems Table 5-4 lists common file types used by Windows –Use information to work with Windows XP –Example: discuss a problem with a vendor

20 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux20 Applications in Windows XP (continued)

21 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux21 Applications in Windows XP (continued)

22 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux22 Applications in Windows XP (continued)

23 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux23 Contents of Files in Fedora Core 4 Fedora Core 4 and Windows XP file similarities –Filenames may have extensions –OS associations open file in a usable format Fedora Core 4 and Windows XP file differences –Extension not required to open a file from the CLI OS reads file header to check the file type –More compression and archive extensions available List of extensions:.bz2,.gz,.tar,.zip,.tgz Multimedia file extensions in Fedora Core 4 –.au,.wav,.gif,.html,.htm,.jpg,.pdf,.png,.txt,.xpm

24 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux24 Contents of Files in Fedora Core 4 (continued) Configuration and installation packaging file types –.conf: a configuration file –.rpm: a Red Hat Package Manager Some extensions for programming files –.c: a C programming language source file –.sh: a shell script Inode: stores file and directory attributes ls –l /dev | more: lists file types in the devices folder file canoe: determines the canoe file type

25 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux25 Contents of Files in Fedora Core 4 (continued)

26 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux26 Contents of Files in Fedora Core 4 (continued)

27 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux27 Viewing Files in Fedora Core 4 Use cat command to view or concatenate files –Example: cat –bsT canoe will open canoe for viewing more command syntax: more [-dlfpcsu] [file...] Some more command options –-num: specifies screen size in lines (an integer value) –-d: displays “[Press ‘h’ for instructions]” –-f: causes more to count logical lines (not folded) –-s: squeezes multiple blank lines into one more –dfs red_canoe: displays red_canoe contents

28 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux28 Viewing Files in Fedora Core 4 (continued)

29 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux29 Using File Attributes File attributes: labels describing and regulating files –Associated with every file in Windows XP –Maintained by components in Windows XP Windows XP handles file attributes most of the time Users can also manipulate file attributes –Learning the technique will prove useful

30 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux30 Using File Attributes in the Windows XP CLI File attributes have binary values of 1 (on) or 0 (off) Four attributes in every DOS file –Read-only: allows file viewing, but not modification –Archive: set to on when file is created or modified –System: marks a file as a system file (a warning) –Hidden: hides a file from other commands

31 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux31 Viewing the DOS File Attributes View attributes and access methods with ATTRIB ATTRIB syntax: ATTRIB [drive:][path][filename][/S] –[drive:][path][filename]: specifies file(s) to process –/S: matches files in current folders and subfolders Syntax is similar to DIR command Wildcards must be used in ATTRIB command –Without wildcards, no files will match

32 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux32 Viewing the DOS File Attributes (continued)

33 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux33 Setting the DOS File Attributes Use ATTRIB to show or change DOS file attributes ATTRIB syntax: ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [drive:][path][filename] [/S [/D]] –+: sets an attribute –-: clears an attribute –R: read-only file attribute –A: archive file attribute –S: system file attribute –H: hidden file attribute Example: ATTRIB +H Secret –Hides the directory named Secret

34 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux34 Using the DIR Command with File Attributes Use DIR to view filenames and specified attributes Syntax: DIR [drive:][path][filename] [/A[[:]attributes]] –[drive:][path][filename]: specifies drive, directory, files –/A: displays files with specified attributes –Attributes: “D”,“R”, “H”, “A”, “S”, “-” (logical not prefix)

35 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux35 Using the DIR Command with File Attributes (continued)

36 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux36 Using the XCOPY Command with File Attributes XCOPY syntax: XCOPY source [destination] [/A | /M] [/H] [/R] [/K] Attribute options –/A: copies only files with the archive attribute set Used for differential backup as archive bit is not reset –/M: copies files with archive bit set; turns off archive bit Used in incremental backup as archive bit is reset –/H: copies hidden and system files –/R: overwrites read-only files –/K: copies attributes; read-only is typically reset

37 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux37 Using File Attributes in the Windows XP GUI Additional attributes: Index, Compression, Encryption –Applies to folders or files residing on an NTFS volume Index –File/Folder indexed by Indexing Service when bit is set –Windows Indexing Service organizes files for search –Index created by Windows XP can be queried Compression –File or folder is compressed when bit is set Encryption –File or folder encrypted when bit is set

38 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux38 Using File Attributes in the Windows XP GUI (continued)

39 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux39 Using Compression in Windows XP Compressing files –Decreases file size –Reduces space that files use on your drives Compressing folders –Decreases space used by files stored in a folder Disadvantage of compression –Potential loss of performance

40 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux40 Using Encryption in Windows XP Encryption: restricts file viewing Users who may view (decrypt) encrypted files –Individual who encrypted the file –Administrator (account has a global key) Encrypting File System (EFS) performs encryption –Installed automatically on Windows XP

41 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux41 Using File Attributes in Fedora Core 4 lsattr: used to view attributes on extended file system Some attributes (meaning when bit is set) –A (“no Access time”): last access time not updated –a (“append only”) Set for file: only allows append operations Set for directory: files may only be added to directory lsattr command syntax: lsattr [options] [file(s)] Some lsattr command options –-d: lists directories like other files –-v: lists the file’s version/generation number

42 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux42 Finding Files Ability to quickly locate files improves computing Scenario: you are asked to write a report –Startup strategy: use a similar report as a template –Problem: finding the old report on the hard drive –Possible solution: search for file using various names File searching techniques covered in next sections

43 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux43 Finding Files in the Windows XP CLI Searches are based on filenames or file contents Pattern-matching methods used in content searches Three commands used to search for files –DIR –FIND –FINDSTR

44 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux44 Finding Files with the DIR Command DIR command supports wildcards Two wildcards used: question (?), asterisk (*) Use ? to substitute for single character only –Example: DIR ?.cpp Command applies in current directory Lists all files beginning with any letter and ending in.cpp Use * to substitute for multiple unknown characters –*.* extends search to include all file extensions –Example: DIR h*.* Lists all files beginning with “h” in the current directory

45 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux45 Finding Files with the FIND Command FIND syntax: FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[...]] –/V: displays all lines without the specified string –/C: displays the count of lines that contain the string –/N: displays line numbers with the displayed lines –/I: ignores the case of characters when searching Example: FIND /I "Good" *.* Redirection operators: “ ” for output –Example: FIND /I "Football" Football.txt Find lines with “Football” in input file, “Winners.txt” Store the output in a file named “Football.txt”

46 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux46 Finding Files with the FIND Command (continued)

47 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux47 Finding Files with the FINDSTR Command Use FINDSTR for more refined searches FINDSTR command syntax: FINDSTR [/B][/E][/L][/R][/S][/I][/X][/V][/N][/M][/O][/P] [/C:string] strings [[drive:][path]filename[...]] Some switches –/B: matches the pattern at the beginning of a line –/I: specifies that the search is not case sensitive –/P: skips files with nonprintable characters Example: FINDSTR /I "good fool" *.* –Finds files containing “good” or “fool”

48 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux48 Finding Files with the FINDSTR Command (continued)

49 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux49 Using the FINDSTR Command with Regular Expressions Regular expressions: specify patterns of text Notation uses metacharacters and literal characters –Metacharacter: symbol pointing to another character Examples: an operator or delimiter –Literal character: refers only to itself Examples: letters and numbers Some examples of regular expressions –w.*ing: strings starting with “w” and ending with “ing” –[ABX]: matches any occurrence of “A”, “B”, or “C”

50 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux50 Using the FINDSTR Command with Regular Expressions (continued)

51 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux51 Using the FINDSTR Command with Regular Expressions (continued)

52 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux52 Finding Files in Windows XP with the Search Companion Versatile graphical search tool –Search by time, file type, filename (all or part) –Use wildcards High-level search options –Pictures, music, video –Documents (word processing, spreadsheet, etc.) –All files and folders –Computers or people Advanced options allow for refined searches Use Change preferences to alter the interface

53 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux53 Finding Files in Windows XP with the Search Companion (continued)

54 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux54 Finding Files in Fedora Core 4 How the find command works –Searches a directory tree by evaluating an expression –Lists the files that match the expression –Returns 0 if all files are processed successfully –Returns greater than 0 if an errors occurs Three elements in the search expression –Options: affect overall operation; always return true –Tests: these elements return a true or false value –Actions: have side effects; return a true or false value Elements are separated by operators; e.g., -and

55 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux55 Finding Files in Fedora Core 4 (continued)

56 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux56 Finding Files in Fedora Core 4 (continued) Some options used with the find command –-xdev: does not check directories on other file systems –-ctime n: file’s status last changed n * 24 hours ago –-empty: file is empty (either a regular file or a directory) –-links n: file has n links Example 1: find /etc –type d | more –Locates directories Example 2: find /etc –type l | more –Locates links

57 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux57 Finding Files in Fedora Core 4 (continued)

58 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux58 Finding Files in Fedora Core 4 (continued)

59 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux59 Summary Filename: prefix plus “.” plus extension File extensions may have three or more characters File extensions help identify associations Access files in Windows XP with Windows Explorer View file contents in Fedora Core 4 using cat and more

60 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux60 Summary (continued) File attributes describe and regulate file use File attribute tools in Windows XP: ATTRIB, DIR, XCOPY, Windows XP GUI File attribute tool in Fedora Core 4: lsattr Tools for finding files in Windows XP: DIR, FIND, FINDSTR, Windows Search Companion (GUI) Tool for finding files in Fedora Core 4: find command


Download ppt "Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 5 Files and File Attributes."

Similar presentations


Ads by Google