COMP 10024 – Fundamentals of UNIX (Week 2)

February 2, 2026 11:03 am Published by






week2

Understanding the UNIX File System

image

In the first class we discussed the "heart" of UNIX, that being the kernel. The "voice" that being the shell which allows you to speak to the OS. Today we will look at the filing cabinet. Enter The UNIX file system. This is what manages, stores and retrieves data across physical disks.

1. What is a File System?

To put it simply, a file system is a method for storing and organizing computer files to make it easy to find and access them.

        Management: It manages data on "random access" devices (like SSDs or HDDs),

ensuring that when you save a file, the bits are placed in an available spot.

        Hierarchy: UNIX uses a tree-like structure. Without this, every file on your computer would be in one giant, unorganized list.

        The Why: We need a file system for persistence (data stays after power-off) and efficiency (finding data quickly).

2. Designing a File System: Blocks and Inodes

Imagine a disk as a large grid of equally sized "storage units" called Blocks. To manage these, UNIX uses three specific types of blocks:

1      Data Blocks: Where the actual contents of your file (the text, the image, the code) live.

2      Directory Blocks: Special files that map "File Names" to "Inode Numbers."

3      Inodes (Metadata): Short for "index nodes."

These are the most important part of UNIX. An Inode does not contain the filename; instead, it contains:

File size

Permissions (Who can read/write?)

Owner information

Timestamps (When was it created?)

Pointers to which Data Blocks hold the actual content.

3. Real-World Implementations

While there are many "flavors" of file systems, UNIX provides a consistent look and feel.

Whether you are using UFS (Unix File System), ZFS (Zettabyte File System), or HFS/APFS

(Apple), the commands you use remain the same. The underlying complexity is hidden from the user by the Kernel.

4. The Hierarchical Structure (The "Tree")

In UNIX, everything starts at the Root, represented by a single forward slash (/). Here is how the structure described in the lecture looks in a text-friendly tree format:

/ (Root)

── file_b

── tmp/

│   └── file_a └── home/

    ── barett/

    │   ── file_a

    │   └── cars/

    │       └── loan.xls

    └── tifa/

        ── file_a

        ── m3.jpg

        └── bikes/

            └── Cervelo.jpg

5. Navigating the System: Paths

To tell the computer where a file is, we use a Path. There are two ways to do this:

A.   Absolute Paths

These always start from the root (/). They work no matter where you currently are in the system. You can think of absolute paths like an address on earth. It is an absolute place: planet/country/city/ neighborhood/street/house-on-the-street

/tmp/file_a

        /home/alice/file_a

        /home/bob/cars/loan.xls

B.   Relative Paths

These start from your current working directory. They do not start with a slash. You can think of this like, if you are lost and stop to ask someone for directions, they will tell you how to get to the destination from where you currently are. Those directions only work from your relative location.

If you are in…

To reach loan.xls, type…

/home/bob

cars/loan.xls

/home

bob/cars/loan.xls

/

home/bob/cars/loan.xls

6. The "Magic" Directories

UNIX provides two "hidden" shortcuts in every single directory to help with relative navigation:

        Dot (.): Represents the current directory.Example: ./file_a (Look for file_a right here).

        Dot-Dot (..): Represents the parent directory (one level up).Example: If Alice is in /home/ alice/bikes and wants to see Bob's files, she uses: ../../bob/file_a.

If you are using the CLI (command line interface) and you need to navigate. You can use "cd .." to go up a directory (like if you are in

"MyDocuments/games/" and need to go back up out of the games folder to the "MyDocuments/" folder.

If you are coding, for example making an HTML and CSS project and your files are as such:

/projectname (Root)

── index.html

── css/

|   └── style.css

└── img/

    └── logo.jpg

There are situations where you night need to navigate in this fashion. Using the file system example above:

In the index.html when pointing to the CSS file that is in it's own folder:

<link href="css/style.css" rel="stylesheet" type="text/css">

Note the css/style.css this is saying go into the folder (from the relative position of the index.html file) and find the file named "style.css".

<img src="img/logo.jpg" alt="company logo"> Note the same here. We tell it go into the img

folder and then look for the file named logo.jpg

 

In the style.css file, accessing an image in the img folder:

background-image: url(../img/logo.jpg);

Note the ../ we discussed earlier. This telling the file to go up a folder into the root. Then go into the img folder and there look for the file named logo.jpg

The examples above might seem a little off base but remember that these examples are files that would exist on a server that is UNIX based and navigating the files in the code examples above work the same way as navigating in the CLI.

7. Essential File System Commands

Com man d

What it does

pwd

Print Working Directory: Tells you exactly where you are in the tree.

cd

Change Directory: Moves you to a new location (e.g., cd /home/alice).

ls

List: Shows you the files and sub-folders in your current spot.

find

Find: Searches the hierarchy for a specific file name or type.

 

Converted to HTML with WordToHTML.net | Document Converter for Windows

Categorised in: , ,

This post was written by amax

Comments are closed here.