Filesystem

File System

  • Reasons to have a file system:
    • Long-term storage
    • Sharable data between processes
    • Structured, hierarchic relationships among files

Typical File Operations

  • Create
  • Delete
  • Open
  • Close
  • Read
  • Write
  • (Seek) is the find??

File Terminology

  • Field
    • Basic element of data
    • Contains a single value (student name)
    • Characterized by its length and data type
  • Record
    • Collection of related fields
    • Treated as a unit
  • File
    • Collection of similar records
    • Treated as a single entity
    • Have file names
    • May restrict access
  • Database
    • Collection of related data
    • Relationships exist among elements

Typical Record Operations

  • Retrieve_All
  • Retrieve_one
  • Retrieve_Next
  • Retrieve_Previous
  • Insert_One
  • Delete_One
  • Update_One
  • Retrieve_Few

List and explain four types of files found in the Unix file system.

  1. Regular files
  2. Directory files
  3. Device files
  4. Symbolic links??

In the UNIX file system, there are several types of files, each serving a specific purpose. Here are four common types:

  1. Regular Files:
    • Regular files are the most common type of files found in UNIX systems.
    • They contain user data, which can be text, binary, program executables, or any other type of data.
    • These files are created and manipulated by users and programs.
    • Examples include text files (*.txt), program executables, images, audio files, etc.
  2. Directory Files:
    • Directory files are special files that store lists of other files and directories.
    • They provide the structure for organizing files and directories in the file system hierarchy.
    • Each entry in a directory file contains the name of a file or directory and its corresponding inode number.
    • Directory files are manipulated using commands like ls, mkdir, rmdir, cd, etc.
  3. Device Files:
    • Device files, also known as device special files or device nodes, represent hardware devices connected to the system.
    • There are two types of device files: character device files and block device files.
    • Character device files allow data to be read or written character by character (e.g., keyboards, mice).
    • Block device files allow data to be read or written in blocks (e.g., hard drives, SSDs).
    • Device files are typically located in the /dev directory and are manipulated using system calls or specialized commands.
  4. Symbolic Links:
    • Symbolic links, also known as symlinks or soft links, are special files that act as pointers to other files or directories.
    • They provide a way to reference a file or directory by a different name or path.
    • Symbolic links contain the path to the target file or directory rather than the data itself.
    • They are created using the ln -s command and can be manipulated using commands like ls, cp, mv, etc.

These are the four primary types of files found in the UNIX file system. Each type serves a specific purpose and plays a crucial role in organizing and managing data within the file system.