Member-only story

Linux System Call — File Operations

Tony
5 min read6 days ago

Linux File Management

Linux file management refers to how Linux organizes, stores, retrieves, and controls access to files and directories. It follows the Filesystem Hierarchy Standard (FHS) and provides various tools and commands to handle file operations.

Linux organizes files in a hierarchical tree structure starting from the root /.

- / Root directory (top-level)
- /home User home directories (/home/user)
- /bin Essential binaries (commands like ls, cp)
- /etc System configuration files
- /var Log files, databases, mail, etc.
- /tmp Temporary files
- /usr User utilities and applications
- /dev Device files (e.g., hard drives, USB)
- /mnt Mounted filesystems (external drives)

File management doesn’t have many variations; you can easily think of the main operations, which are nothing more than creating, opening, reading, and writing files.

For file operations, the following six system calls are the most important:

  • For an existing file, use open to open the file and close to close it.
  • For a nonexistent file, use creat to create it.
  • After opening a file, use lseek to jump to a specific position within the file.
  • To read or write file content, use read for reading and…

--

--

Tony
Tony

No responses yet