Linux Kernel is a file based but Windows is an API based.

This just means that in Linux, we can use the same file System Call (系统调用) on IO Device like Special File & Unix Domain Socket besides the regular files, where Windows has an separate Windowa API for those IO Devices.

  • Hide the nitty gritty of IO Device, so users can focus on manipulating the content inside the IO Device

  • Present programmer a clean Abstraction (抽象) of device-independent file

  • Examples are Printers & Modems etc

  • 2 parts - Filename & Inode Number, doesn’t have any metadata associated

File Descriptor

File Permission

  • In POSIX, file permissions are handled by rwx bits

Special File

Block Special Files

Character Special Files

  • Model IO Device that accept or output a character stream like keyboard

Line Break in File

  • POSIX systems uses a single character called Line Feed \n
  • While Windows uses carriage return and Line Feed, so 2 characters \r\n. This is because during typewriter times, you needed to mov the carriage to restart typing on the beginning of a line first, then turn the wheel to move the paper to change the line


You can install dos2unix and unix2dos using Brew to play with line break.

You can view the hidden line break character by downloading and configuring bat.

Useful CLi Tools


  • A cat clone with wings.
brew install bat && echo "alias cat='bat'" >>~/.zshrc


  • Manage files fast, powered by rust!
brew install dua-cli
dua interactive


  • cp on tren!
cargo install xcp
# Alias to cp
alias cp="xcp"


  • Generate a hexdump from a binary file and display the output
xxd <BINARY_NAME.bin>