Presentation is loading. Please wait.

Presentation is loading. Please wait.

June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure.

Similar presentations


Presentation on theme: "June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure."— Presentation transcript:

1 June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure

2 June 1, 1999UNIX File System2 Performance Objectives: 1. Identify types of Files (file) 2. Diagram the relationship of Files and Directories 3. Navigate the UNIX Directory Structure (cd, pwd) 4. Identify pathnames: Absolute (/) and Relative (... ~) 5. Define file naming conventions 6. Make and remove directories (mkdir, rmdir) 7. List files and directories and their attributes (ls)

3 June 1, 1999UNIX File System3 Types of Files Documents (ordinary files) Directories (help organize other files) Commands Special files - pipe | Hidden files (dot) Devices

4 June 1, 1999UNIX File System4 Relation of Files & Directories Root is like a file cabinet. n A directory is like a file drawer n A subdirectory is like a folder within a drawer. n A path is a list of directories & subdirectories from root to a specific file or subdirectory. / Root Directories Files

5 June 1, 1999UNIX File System5 UNIX Directory Structure At login, you are in your home directory. This is your current working directory. All files and directories below your home directory usually belong to you. You change your working directory by changing to another directory (cd).

6 June 1, 1999UNIX File System6 Pathnames Absolute Pathname : n shows the absolute position of a file or directory in the hierarchy; /home/user2/bif/docs n begins with a slash (/); and n describes how to get to the file from the root.

7 June 1, 1999UNIX File System7 Pathnames Relative Pathnames: n Describes how to get to a file from your current working directory. n Special characters represent directory locations. è home directory ~ ~chidhkra è current directory. cp ~chidhkra/file. è parent directory.. cp ~chidhkra/file..

8 June 1, 1999UNIX File System8 Filesystems A file is identified by n Combining directory pathnames n To the filename /usr/local/meeting root files usr local meeting /

9 June 1, 1999UNIX File System9 Naming Files Filenames may be 1 to 255 characters n UPPER and lowercase, n numbers, n other ASCII characters, n except special Shell characters, control characters and the space.

10 June 1, 1999UNIX File System10 Filename DON'TS Don't begin a filename with a dot (.) Don't use any of the following characters ; ? { } < : | * \ > # ( ) [ ] ' $ - & ~ " ! % /

11 June 1, 1999UNIX File System11 Examples of UNIX File Names: status.memo casey_mt 1.2.3 chapter1

12 June 1, 1999UNIX File System12 Hidden Files (dot) Used to establish your environment:.cshrc.login.pinerc.forward Must use ls -a option to view Always in home directory (some exceptions)

13 June 1, 1999UNIX File System13 Naming Conventions Programs like make, cc, and sccs use a default conventions to name files generated:.o Binary Compiler Output. i C preprocessor Output.c C/C++ language source code.f Fortran source code.mk Makefiles s. SCCS files a.out executable name.j FPP output files.a AR or BLD files.Z compressed files (use uncompress).gz gzipped files (use gunzip).tar tape archive (use tar).l compiler listings

14 June 1, 1999UNIX File System14 Identifying File Content The command file identifies file content: host% file passwd passwd: ascii text host% file ~dhk/* PSaddress: PostScript document acl: directory address: [nt]roff, tbl, or eqn input text adv.fil: ascii text cfs.size: executable shell script dip: shell commands

15 June 1, 1999UNIX File System15 Directory Commands mkdirmaking a directory cdchanging your working directory pwdprinting your working directory lslisting the contents of a directory rmdirremoving a directory

16 June 1, 1999UNIX File System16 Directory Commands - mkdir Make directory under current working directory host% mkdir docs Make directory under subdirectory host% mkdir docs/index Make directory and subdirectory host% mkdir docs docs/index Make directory using absolute path host% mkdir /usr/tmp/abc User1 docs User1 docs index (cwd)

17 June 1, 1999UNIX File System17 Common Error Messages: mkdir: dirname: File exists mkdir: dirname: Permission denied

18 June 1, 1999UNIX File System18 Directory Commands - cd host% cd docs host% cd /usr/tmp/abc/docs host% cd ~abc/docs host% cd host% cd.. userx docs /usr tmp abc docs ~abc docs

19 June 1, 1999UNIX File System19 Common Error Messages: pathname: No such file or directory pathname: Permission denied

20 June 1, 1999UNIX File System20 Directory Commands - pwd Determining the current working directory: host% pwd /scc/users/chitspit/bif where: è / root è scc/ file system followed by the delimiter (/) è users/ subdirectory of scc è chitspit/ directory followed by the delimiter (/) è bif current working directory

21 June 1, 1999UNIX File System21 Directory Commands - ls host% ls bin mbox remodel complex.f outdis test host% ls -sF (Multiple options may be specified) 15 bin/ 256 mbox 3 remodel/ 34 complex.f 6 outdis@ 1 test* host% ls ~chitspit/bin au clst prod show xref cwd

22 June 1, 1999UNIX File System22 Directory Commands - ls The long list provides additional file information: host% ls -l total 31 drwxr-xr-x 2 dhk 512 Oct 23 1985 bin -rw-r--r-- 1 dhk 129 Nov 20 1985 comp -rw------- 1 dhk 129 Jul 2 10:05 mbox -rw-r--r-- 1 dhk 4291 Jun 16 14:18 outdis drwxr-xr-x 2 dhk 512 Jan 22 11:07 remod -rwxr-xr-x 1 dhk 10291 Mar 19 12:55 test List alphabetized

23 June 1, 1999UNIX File System23 List Hidden Files: ls -a The -a option lists all files in a directory: host% ls -a..login mail test.. bin public_html.cshrc complex.f remodel

24 June 1, 1999UNIX File System24 Directory Commands - rmdir The rmdir command removes directories. host% rmdir bif/docs Directory must be empty. Common error messages: è rmdir: docs: Directory not empty è rmdir: /scc/users/abc/docs: Permission denied userx bif docs

25 June 1, 1999UNIX File System25 End of Module Complete UNIX File Structure Exercises


Download ppt "June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure."

Similar presentations


Ads by Google