Download presentation
Presentation is loading. Please wait.
Published byPhoebe Nash Modified over 6 years ago
1
UNIX File System Go Climb a Tree Weiyu Zhang (96142)
COSC513 Operating Systems Southeastern University
2
Introduction It is true.
In UNIX, the thing we spend most of our time working with is files. Treating files consistently is one of the greatest strengths in UNIX. It is true.
3
What is “consistent”? UNIX use the same method to save all the files.
For example, an executable script has the same format as a text file. Simplify the file system. The idea is widely used later. (In DOS, Win95/98, etc.)
4
Three types of UNIX Files
Regular files Directory files Device files
5
Regular files Most common type Hold programs and data Example:
Source code of a program received from friend Executable programs and applications (such as ls, cat, etc.)
6
Directory files Basic management tools in UNIX file system
Like a cabinet in real life, the files that contain other files Save information of files (such as location, size, etc.)
7
Devices files Each hardware is treated like a file Example Terminals
Printers Keyboards, etc.
8
More about device file Example: Convenient to handle
Read the user input read from a keyboard device file. Print a text file Copy the file to the printer device file. Convenient to handle
9
File system organization
A bottom-up tree with root on the top All the files must be put into directory files Root (/), a special directory file Exact one Can not been deleted
10
One sample “tree” Root (/) bin/ dev/ etc/ usr/ zhang/ li/ wang/ ...
letter.txt Hello.c
11
Find a file in UNIX Start from the root
Go down (or climb) the tree, record the path Each file has a name
12
An example Root (/) bin/ dev/ etc/ usr/ zhang/ li/ wang/ ...
letter.txt Hello.c /usr/wang/letter.txt
13
File and directory permission
Only need in a multi-user OS Keep your own secrets Three classes of users Three permissions
14
Three classes of users Owner: I created the file.
Group: The owner and I are in the same working group. World (a.k.a. other): I just want to use the file.
15
Three permissions Read permission: read
Write permission: modify, delete Execute permission: run No exact priority, normally write permission is the most important one
16
Nine bits (3 3)
17
Nine bits (continue) 1 for Y and 0 for N. So the permission of the file is ( )2
18
Why permission Keep your secrets.
In the above example, world user can not read the file, group user can not modify or delete the file.
19
Why permission (cont) Keep your secrets.
Show more information about a file. Since the files are saved consistently, only those which have the execute permission set can be run.
20
Why permission (cont) Keep your secrets.
Show more information about a file. Avoid wrong operation Setting the owner write permission to be ‘N’ (or 0) can avoid the careless delete of very important files.
21
I have no permission but I can ...
22
Conclusions Everything is a file. Bottom-up tree organization
Easy but safe
23
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.