file-offset · shipping · also current file offset, file position

File offset

A file offset is a byte position measured from the beginning of a file, used as a current I/O cursor or an explicit positional-access argument.

Related Observatory article: File offset on hesela.com

The current cursor belongs to the open file description. Duplicating a descriptor shares that cursor; opening the file separately creates a new open file description. A descriptor number and an offset therefore identify different parts of an I/O request. [1] [2]

For regular files, lseek can position the cursor beyond EOF without enlarging the file. SEEK_SET, SEEK_CUR and SEEK_END interpret the supplied displacement relative to the beginning, current position and file size respectively. A byte position does not describe physical allocation or a device-sector address. [3]

pread and pwrite supply an explicit position without advancing the current cursor. A separate lseek then read sequence needs coordination if another holder can move that cursor between calls. [4] [2]

Relations

related
Open file description, File descriptor, pread, pwrite, Short read, Sparse file, File truncation

Limitations

  • Not a file length or a measure of consumed or allocated bytes.
  • Independent cursors do not isolate readers from changes to file content.

Citations

  1. Linux man-pages 6.19: open(2), open file descriptions (accessed 2026-11-02)
  2. Linux man-pages 6.19: dup(2), shared cursor state (accessed 2026-11-02)
  3. Linux man-pages 6.19: lseek(2), origins and seeking beyond EOF (accessed 2026-11-02)
  4. Linux man-pages 6.19: pread(2), explicit-position I/O (accessed 2026-11-02)
Sources & caveats
  • The byte-position concept is distinct from the open file description that stores a current cursor.

JSON: /data/terms/file-offset.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. File offset. Hesela. 2026-11-02. https://hesela.dev/terms/file-offset/