File: abstraction of persistent storage with logical grouping of data
Operation on Files:
create
read, write
seek
delete
truncate
append
rename
open: do expensive directory lookup, store partition, file number, allowed operations, cursor position (shared across processes)

Program loader needs to know executables with magic number in first two bytes:
ELF: 0x7F, 'E', 'L', 'F'
'#!' for scripts
if not, then it's a data file (array of bytes)
you can use
filecommand to check the type of a data file
Sequential Access: read(), write() rewind() seek() Indexed Access: (for files contains records), index key to value
Operations:
lookup
create
delete
rename
iterate over
scan (find)
change notification (watch)
Hard link: instead of a tree, it's a DAG where we allow a file to own by multiple directories.
any change to file reflects in all directories
delete a file only removes the link, the file is deleted when all links are removed
hard link only apply to files, not directories (to avoid cycles)
Soft link: symbolic link, short cut
if somebody delete the original file, the soft link becomes dangling
can link to directories, but not across file systems
Mounting: attach a file system to a directory, the directory becomes the root of the file system
User/Group: uid/gid, used for access control
access mode: read, write, execute (append, delete, list, lock)
access control list (ACL): (user, mode) tuples, cumbersome to store/view/manage
capability: given user a list of (file, access keys) tuple, hard to revoke
typical: every file has permission for owner, group, and other (and rwx for each), we have 16 bits to store permissions, user#, group# (which is tight, will not allow many users/groups)
Table of Content