Computer file
|
A file in a computer system is a stream (sequence) of bits stored as a single unit, typically in a file system on disk or magnetic tape.
While a file is usually presented as a single stream, it most often is stored as multiple fragments of data at different places on a disk (or even multiple disks). One of the services operating systems usually perform for applications is that of organization of files in a file system.
Files are created by software and usually conform to a particular file format. They are almost always assigned file names by the file system on which they are stored, so that they can be referred to at a later time.
Some operating systems allow the contents of a file to be segmented into fixed and variable length records. For example, OpenVMS allows any arbitrary set of characters to be defined as the terminators to variable length record within a file. Others, like Microsoft Windows, have only one specialised subclass of file, called a text file, where a sequence of characters separate the data into lines of text (a specialised variable length record). Some operating systems, such as UNIX, do not have ability to handle file records at the operating system level, instead it is done at the application level. See record-oriented filesystem.
A special file is a file system object which is accessed as though it was a file, but the sequence of bits is supplied or consumed by another process (or by the operating system itself) such as a device driver or network interface. Indeed, the philosophy that "everything is a file" is one of the best known design decisions in Unix and Unix-like operating systems (such as Linux).
Files are often organized hierarchically by the operating system, placing them in directories.
Notes
- A collection of bytes in RAM isn't usually known as a file, unless it's stored in a RAM disk.
- Historically 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.
- Some operating systems use an extension (or "suffix", although the extension does not have to be placed at the end of the filename -- some systems may place it before the filename, for example) to differentiate between files whose contents or data are organized in different formats. The operating system, as well as the underlying file system, may impose restrictions on the length of file extensions. For example, MS DOS limits file extensions to three characters or less. Examples of common file extensions on MS-DOS systems include .EXE for executable programs, .TXT for plain text files, and .ZIP for archives encoded and usually compressed using methods compatible with PKWARE's PKZIP archiver product. File extensions are commonly used to simplify file management tasks for users. For example, suppose you have a directory containing files of different media formats. Some are still images, some are animations, and some are digitally sampled audio waveforms. If you know that all the samples have an extension of .PCM, you could easily issue a copy command to copy all these files to a different directory, whether it be within the same file system or on a separate physical disk. Many application software programs use the presence of a header in the file formats with which they work to determine the actual type of a given file. For example, an executable program on DOS may have an extension of .COM even though the .COM extension is usually reserved for a different, more simple executable format. DOS knows that the file is an executable because of the presence of some signature bytes at the start of the file. 'Unix like' operating systems do not have any fixed extension for files, although .tar, .gz, .sh, and others are standard (see also magic numbers). In many cases, standardised file extensions are useful because they make it easier for users of different computer systems and operating systems to share files, since the format of a file's content is more clear.
See also
External links
- Filename.info - Information about Microsoft Windows filenames (http://www.filename.info/)
- Information about Files (http://www.2-files.com/)
- Exploited files (http://www.2-spyware.com/files.php) — list of filenames which are used by various parasites to deceive the user.
da:Fil de:Datei es:Archivo informático fr:Fichier fy:Triem nl:Bestand (computer) pl:Plik pt:Arquivo ru:Компьютерный файл sl:Datoteka zh:计算机文件