How files are stored on disk — inodes, blocks, and permissions
Inode Structure POSIX
Field
Size
Description
mode
2 bytes
File type + permissions
uid
4 bytes
Owner user ID
gid
4 bytes
Owner group ID
size
8 bytes
File size in bytes
atime
8 bytes
Last access time
mtime
8 bytes
Last modification time
ctime
8 bytes
Last status change time
nlinks
2 bytes
Hard link count
File Permissions chmod
-rwxr-xr-x 1 user group 4096 Dec 27 12:00 script.sh
drwxr-xr-x 2 user group 4096 Dec 27 12:00 directory/
-rw-r--r-- 1 user group 1024 Dec 27 12:00 document.txt
Octal
Binary
Permissions
Common Use
755
111 101 101
rwxr-xr-x
Executables, directories
644
110 100 100
rw-r--r--
Regular files
600
110 000 000
rw-------
Private files (SSH keys)
777
111 111 111
rwxrwxrwx
Full access (avoid)
700
111 000 000
rwx------
Private directories
Bit
Value
Meaning
r
4
Read
w
2
Write
x
1
Execute (files) / Search (directories)
Directory Entry dirent
Entry
Description
.
Current directory (self-reference)
..
Parent directory
filename
Maps name to inode number
Filesystem
Max Filename
Max Path
ext4
255 bytes
4096 bytes
APFS
255 UTF-8 chars
1024 chars
NTFS
255 UTF-16 chars
32767 chars
Filesystem Defaults ext4, APFS, NTFS
Property
ext4
APFS
NTFS
Block size
4 KB
4 KB
4 KB
Max file size
16 TB
8 EB
16 EB
Max volume size
1 EB
16 EB
16 EB
Inode size
256 bytes
variable
1 KB (MFT)
Journaling
Yes
Yes (COW)
Yes
Case-sensitive
Yes
Optional
No*
Block Size
Description
512 B
Traditional sector size
4 KB
Typical filesystem block (modern default)
4 KB
Memory page size (most architectures)
File Descriptors POSIX
# Redirect stdout to file
command > output.txt
# Redirect stderr to file
command 2> errors.txt
# Redirect both
command > output.txt 2>&1
# Pipe stdout to next command
command1 | command2