Computer file
A file in a computer system is a sequence of bytes
stored as a single unit, typically in a filesystem on a disk
or a tape (but see Historical Note below).
"File" is an abstract concept: what appears to be a single file from
the point of view of software may in practice be stored as
multiple fragments of data at different places on a disk (or even
multiple disks).
Implementing a system to store arbitrarily-sized files on disk is a complex
process, particularly when considering that most file systems offer facilities
for arbitrary resizing, creation, deletion, and in-place modification. Such
a file system generally makes up a major part of an operating system. In
fact, early microcomputer operating systems only real task was such file
management - a fact reflected in their names.
/* need some mention of file permissions */
Files are created by software and usually conform to a particular
An important subclass of file is the "text file". A text file is a
sequence of characters organised into lines
(or "records") separated by line breaks.
The preferred representation of line breaks differs among operating systems.
For example, Mac OS uses 0x0d, UNIX systems use 0x0a, and Windows uses 0x0d followed by 0x0a.
To modify a text file, use a text editor.
Some text editors can understand multiple systems' line break conventions.
The term "binary file" often refers to any file other than a text file.
But note that ultimately even a text file is just a collection of bits.
To modify a binary file directly (that is, without using a specific application), use a hex editor.
Note: a collection of bytes in RAM isn't usually known as a file,
unless it's stored in a RAM disk.
Historical Note: in the past it was common for files to be defined as sequences of records.
However this is now uncommon except on certain mainframe operating systems.
On most systems, the application or a library creates the "record" abstraction from the byte stream according to the file format.