File System Structure - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

File System Structure

Description:

Navigation : a sample tree. Navigation. Via listing of the directories -End to a directory ... edit a file UNIX-class that is listed in the Proposal directory? ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 29
Provided by: Kami47
Category:

less

Transcript and Presenter's Notes

Title: File System Structure


1
File System Structure
  • Directory Structure
  • Navigation
  • -Absolute
  • -Relative
  • Access Permission
  • -chmod
  • -umask

2
File Naming Rules
  • What can be used for naming files in Unix are
  • -letters (uppercase, lowercase)
  • -numbers
  • -comma
  • -underscore
  • -period
  • Number of characters
  • -14 characters some to 225 characters
  • To hide a file Use period at the beginning of the
    file name

3
File System
  • How to organize all the programs and data on the
    storage device of the computer?
  • Hierarchical structure
  • -Like a family tree

4
Family Tree
5
Unix Tree
6
Navigation a sample tree
7
Navigation
  • Via listing of the directories
  • -End to a directory
  • eg, /home/ce144f15/Personal
  • -End to a file
  • eg, /home/ce144f15/UNX122/Labs/Lab1/lab1a
  • Via symbols
  • / .. ../.. ../../../..

8
Types of Pathnames
  • Absolute pathname
  • -Begins from root
  • eg,
  • cd /home/ce144f15/UNX122
  • eg,
  • cd /UNX122/Labs/Lab1/lab1a
  • ( represents /home/username)

9
Types of Pathname
  • Relative pathname
  • -Begins from the current directory
  • eg,
  • cd ../Labs/UNX122
  • more ../Document/readme

10
Task 1
  • Assume your current directory is not known. What
    command changes your current directory to a
    directory named Education, which is listed in a
    directory named Proposals, which is listed in
    your home directory?
  • 2. From your home directory, what command do you
    enter to edit a file UNIX-class that is listed in
    the Proposal directory?

11
Task1 (cont.)
  • 3. From your home directory, how can you create a
    directory Rejected, listed in the Proposals
    directory?
  • 4. How would you copy a file marks from your home
    directory into Education, a subdirectory of the
    Proposals directory.
  • 5. How can you copy all files from the current
    directory to the parent?

12
Access Permissions
  • Who should have what access to what?
  • who
  • user (u), group (g), others (o)
  • What access
  • read, write(modify), execute
  • what
  • Directories
  • Files

13
Identifying the Fields
  • drwxrwxrwx 4 John Students 533 Sept 20
    1945 myfile
  • Permission links owner group size date of
    modif. name

14
Example
  • How do you manage these two files?
  • -Plans (to a new product)
  • -Memo (to all)

15
Chmod Relative Method
  • Chmod who operation permission filename
  • Who
  • u(user), g(group), o(others)
  • Operation
  • (add), - (remove), (set permission)
  • Permission
  • r (read), w (write), e(execute)

16
Relative Method (examples)
  • Add permission
  • chmod grw filename
  • chmod ox filename
  • Remove permission
  • chmod g-w file.name
  • chmod a-w file.name
  • (remove w for all, ugo)
  • Set permission
  • chmod orx filename
  • chmoc gorx filename

17
Task 2
  • What permissions are granted, to which classes of
    users, for a file with the following permissions
    field
  • -r-x- - - - - -
  • What command would you use to change a files
    permissions to include read, write, and execute
    permission for the group only.
  • What would the files permission field look like
    after you changed its mode as above.

18
Chmod Absolute Method
  • Use octal number to represent binary
  • 1 (add) 0 (remove)
  • Octal Binary
  • 0 000
  • 1 001
  • 2 010
  • 3 011
  • 4 100
  • 5 101
  • 6 110
  • 7 111

19
Relative Method
  • 755 111101101rwxr-xr-x
  • R-----------100 ------------4
  • W-----------010------------2
  • X-----------001-------------1
  • Chmod 777 filename
  • Chmod 741 filename

20
Task3
  • Fill in the blank spaces in the following table

21
Creating a mask
  • How the initial setting permissions are
    established?
  • Default permissions
  • -file 666
  • -Directory 777
  • The umask command automatically sets the file
    permissions upon creation of the file
  • . To automatically establish file permission upon
    creation
  • umask mask

22
Mask (cover, deny)
  • Mask is represented by number
  • 0 mask nothing, allow everything
  • mask execute, allow
  • mask write, allow
  • Mask write and execute, allow
  • mask read, allow
  • 6 mask read write and allow only x

23
Conceptual Method
  • Umask 022
  • For a directory results in
  • Drwxr-xr-x
  • For a file
  • -rw-r- -r- -
  • Tell me why?

24
Compare
  • Directory Default permission
  • d rwx rwx rwx (777)
  • umask 022
  • 0 2 2
  • Result
  • rwx rwx rwx
  • 0 2 2
  • rwx r-x r-x

25
Compare
  • File Default permission
  • -rw-rw-rw
  • Umask 022
  • Result
  • Rw- rw- rw-
  • 0 2 2
  • Rw- r- - r - -

26
Calculation Method
  • Setting Directory permissions
  • To set mask for newly-created directories tor w
    x r - - r - -
  • Determine octal number 744
  • Subtract 777 from 744 033
  • Issue command umask 033
  • Issue command umask to verify change
  • The Same for file. Just Remember the default
    permission for file is different.

27
Task 4
  • 1. What command sets the permission fields of all
    newly created directories to read, write, and
    execute for owner, and execute only for everyone
    else?

28
Task 4
  • 2. If umask is 022 and the permissions on a file
    named scriptA are rwxr-xr-x, what are the
    permissions for the resulting files when you
    enter the following commands?
  • touch abc
  • mkdir def
  • who gt ghi
  • Cp scriptA scriptB
Write a Comment
User Comments (0)
About PowerShow.com