Skip to main content
We save files all the time — photos, screenshots, essays. But where do these files actually live? And what decides whether you or someone else can open them later? This lesson explains two core concepts: files and file management. You’ll learn where data is stored, how it’s organized, and how the operating system (OS) enforces access. We’ll cover:
  • What a file and folder (directory) actually are
  • Paths: absolute vs relative
  • How the OS maps names to data (directory tables / metadata)
  • Common file systems (FAT32, ExFAT, ext4, NTFS) and their tradeoffs
  • Journaling, mounting, and practical choices for formatting drives
Think of the OS as a librarian: it doesn’t just dump items on shelves — it catalogs them, places them in the right drawer, and controls who can read or write them.
A presenter wearing a KodeKloud t-shirt gestures on the right side of the image. To the left is a black-background diagram with a laptop icon, file and folder icons arranged in a hierarchical tree, and the word "macOS" next to a Windows-style logo.

Basics: files, folders, and paths

A file is a block of digital data — an image, document, executable, etc. Folders (directories) are entries in the OS’s directory table that group files into a hierarchical structure. At the very top is the root directory:
  • Windows root example: C:\
  • macOS / Linux root: /
From the root the OS builds a directory tree. A full (absolute) path shows exactly where a file lives. For example, a photo file:
  • Absolute path:
/Users/alan/Pictures/kody.png
  • Relative path (from /Users/alan):
Pictures/kody.png
Command-line examples (macOS / Linux style) demonstrate how you inspect the current location and list files:
cd ~/Pictures
pwd
# Example output:
/Users/alan/Pictures

ls
# Example output:
Camera\ Roll  Photo\ Booth\ Library  kody.png  Photos\ Library.photoslibrary

ls -l kody.png
# Example output:
-rw-------@ 1 alan staff 1210528 Jan 14 15:22 kody.png
The ls -l output shows important metadata: owner, permissions, size, and timestamps. Behind the scenes, the OS stores this metadata in internal records (directory tables or metadata entries) that map file names to where their data blocks live on storage.
A presentation slide showing a "Directory Table" with rows for filenames, paths, types, sizes, creation dates and permissions. A person stands to the right of the slide, gesturing while speaking.
You normally see one row of this table at a time (a filename and its details), but the OS consults the full table to locate and open file data. Example (simplified directory-table rows):
File Name      | Path              | Type    | Size (bytes) | Created     | Permissions
---------------------------------------------------------------------------------------
filename.txt   | /home/user/...    | regular | 4096         | 2024-06-18  | rw-r--r--
dir1           | /home/user/...    | dir     | -            | 2024-06-12  | rwxr-xr-x
script.sh      | /home/user/...    | regular | 532          | 2024-06-10  | rwxr-x--
When you open a file, the OS looks up its directory entry, finds the disk blocks (or extents) that hold the file contents, and reads those blocks into memory for your application. Quick quiz What does a folder actually represent? A) A separate storage location
B) A physical container on the hard drive
C) A label/entry in the directory table
Correct answer: C — folders are metadata the OS uses to organize files. The icons and colors you see in a file manager are visual aids; to the OS they are directory entries mapping names to storage locations.
A presenter stands beside a colorful quiz slide titled "What does a folder actually represent?" showing multiple-choice answers and a cartoon cat with a speech bubble about color‑coding folders. The presenter is wearing a KodeKloud shirt.

File systems: the rule books for storage

A file system defines the rules the OS uses to name files, place them on storage, and keep track of metadata (owner, permissions, timestamps). If your OS doesn’t understand the file system on a device, it can’t interpret the bits on that device — even when physically connected. Common file systems differ in features, compatibility, and limits.
A presenter stands on the right in front of a dark infographic showing USB-related icons (USB stick, phone, external drive, camera) and folders, with the heading “Same connection. Different outcomes.”

Major file systems: FAT32, ExFAT, ext4, NTFS

Below is a quick reference comparison to help choose the right file system for common tasks.
File SystemTypical use caseProsCons
FAT32USB sticks, SD cards for maximum compatibilityVery widely supported across devices and OSesMax file size ~4 GB; limited partition sizes; no journaling or rich permissions
ExFATLarge files on removable media (videos, disk images)Supports files >4 GB; broad modern OS/device supportNo journaling or rich permissions; slightly less ubiquitous than FAT32 on older devices
ext4Linux internal disks and serversJournaling, speed, reliability, Linux-native featuresNot natively supported on Windows/macOS without drivers
NTFSWindows internal drives and advanced featuresPermissions, encryption, journaling, resilient metadata (MFT)macOS mounts read-only by default; incomplete support on other OSes without drivers
FAT32 (File Allocation Table)
  • Breaks storage into clusters. Files may be stored in clusters that are not contiguous.
  • Directory entries point to the starting cluster, and the FAT (a linked list table) is followed to find subsequent clusters (e.g., 17 → 23 → 45 → END).
  • Simple and broadly compatible, but limited to ~4 GB per file.
A presenter stands to the right of a slide showing a diagram of FAT32 file allocation with a grid of storage clusters and PNG file parts, with "Clusters" and "Storage" labels and a KodeKloud logo on the speaker's shirt.
FAT32 follows a cluster chain:
A presentation slide showing a FAT32 cluster chain diagram (blocks 17 → 23 → 45 → END) and a "choose your own adventure" book icon on a black background. A man in a black KodeKloud t‑shirt stands to the right, appearing to present.
ExFAT
  • Designed to overcome FAT32’s file-size limit while remaining cross-platform.
  • Ideal for large media files on removable drives.
  • Does not provide the richer metadata features (permissions, journaling) found in modern internal filesystems.
ext4 (common on Linux)
  • Uses inodes: each inode stores metadata and pointers to data blocks (with indirect pointers for large files).
  • Supports journaling to reduce corruption risk after crashes.
  • Performs well on Linux but requires additional tools or drivers to access natively on Windows/macOS.
A presentation slide showing a FAT32 file allocation table (table of filenames, paths, types, sizes, creation dates and permissions). The presenter is wearing a "KodeKloud" shirt and is gesturing while explaining.
NTFS (Windows default)
  • Uses a Master File Table (MFT): a centralized index where each file’s name, metadata, and storage pointers are recorded.
  • Provides advanced features: ACL-based permissions, encryption, compression, and journaling.
  • Best for Windows system drives; other OSes may need extra drivers to write reliably.
A presentation slide about the NTFS file system showing a file icon labeled "Report.txt" with timestamps, permissions, and extents listed, alongside a stylized master file table graphic. A man wearing a KodeKloud shirt stands to the right speaking.
A presenter stands to the right of a slide titled "Choose the right tool for the job" that compares filesystem types (FAT32, exFAT, ext4, NTFS) and their features. The speaker is wearing a KodeKloud shirt.

A short note on journaling

Journaling records pending filesystem operations (a short transaction log). After a crash, the OS replays or rolls back those journal entries to restore consistency, greatly reducing the chance of corruption and improving recovery time.

Mounting: attaching a device into the directory tree

Even when the OS understands a file system, a device must be mounted to make its files part of the system’s directory tree. Until mounted, a device may only charge or show as an unrecognized format. Typical mount points by OS:
  • Linux/macOS example mount points:
/mnt/usb
/Volumes/USB
  • Windows:
D:\
Mounting connects the device’s root into the OS directory tree so you can navigate it with the normal path hierarchy.
Formatting a disk erases its data. Always back up important files before reformatting or changing the filesystem on removable or internal drives.

Quick decision guides

  • Need to move a 10 GB video between macOS and Windows? Use ExFAT.
  • Need rich permissions and journaling for a Linux server disk? Use ext4.
  • Sharing tiny files with older cameras or very old devices? FAT32 might still be required.
  • Windows system drive or heavy use of ACLs/encryption? NTFS.
Final quiz You’re on a Mac and need to format a USB drive to hold a 10 GB video. Which file system should you choose? A) FAT32
B) ExFAT
C) NTFS
Correct answer: B — ExFAT. FAT32 has a ~4 GB file-size limit. NTFS is typically read-only by default on macOS without extra drivers.

Recap

  • Files are blocks of data; folders are directory entries (metadata) used to organize them.
  • Paths (absolute and relative) locate files within the directory tree.
  • The OS maps filenames to storage locations using directory tables, inodes, or an MFT depending on the filesystem.
  • Common filesystems (FAT32, ExFAT, ext4, NTFS) trade compatibility, maximum file size, permissions, and journaling differently — pick the right one for the job.
  • Journaling improves crash recovery; mounting integrates a device’s filesystem into your directory tree so it’s accessible.

Watch Video