System Files
The files in this section are system files. These files are created and maintained by the operating system and are necessary for the system to perform its many functions. System files are used by many commands and subroutines to perform operations. These files can only be changed by a user with root authority.
A file is a collection of data that can be read from or written to. A file can be a program you create, text you write, data you acquire, or a device you use. Commands, printers, terminals, and application programs are all stored in files. This allows users to access diverse elements of the system in a uniform way and gives the operating system great flexibility. No format is implied when a file is created.
Files are used for all input and output (I/O) of information in this operating system. This standardizes access to both software and hardware. Input occurs when the content of a file is modified or written to. Output occurs when the content of one file is read or transferred to another file. For example, to create a hardcopy printout of a text file, the system reads the information from the text file and writes the data to the file representing the printer.
Collections of files are stored in directories. These collections of files are often related to each other, and storing them in a structure of directories keeps them organized.
There are many ways to create, use, and manipulate files. Files in Operating system and device management introduces the commands that control files.
Types of Files
There are three basic types of files:
File Type | Description |
---|---|
regular | Stores data (text, binary, and executable). |
directory | Contains information used to access other files. |
special | Defines a FIFO (first-in, first-out) file or a physical device. |
All file types recognized by the system fall into one of these categories. However, the operating system uses many variations of these basic types.
Regular files are the most common. When a word processing program is used to create a document, both the program and the document are contained in regular files.
Regular files contain either text or binary information. Text files are readable by the user. Binary files are readable by the computer. Binary files can be executable files that instruct the system to accomplish a job. Commands, shell scripts, and other programs are stored in executable files.
Directories contain information the system needs to access all types of files, but they do not contain the actual file data. As a result, directories occupy less space than a regular file and give the file-system structure flexibility and depth. Each directory entry represents either a file or subdirectory and contains the name of a file and the file's i-node (index node reference) number. The i-node number represents the unique i-node that describes the location of the data associated with the file. Directories are created and controlled by a separate set of commands.
Special files define devices for the system or temporary files created by processes. There are three basic types of special files: FIFO (first-in, first-out), block, and character. FIFO files are also called pipes. Pipes are created by one process to temporarily allow communication with another process. These files cease to exist when the first process finishes. Block and character files define devices.
Every file has a set of permissions (called access modes) that determine who can read, modify, or execute the file. To learn more about file access modes, see File ownership and user groups in Operating system and device management.
File-Naming Conventions
The name of each file must be unique within the directory where it is stored. This insures that the file also has a unique path name in the file system. File-naming guidelines are:
- A file name can be up to 255 characters long and can contain letters, numbers, and underscores.
- The operating system is case-sensitive which means it distinguishes
between uppercase and lowercase letters in file names. Therefore,
FILEA
,FiLea
, andfilea
are three distinct file names, even if they reside in the same directory. - File names should be as descriptive as possible.
- Directories follow the same naming conventions as files.
- Certain characters have special meaning to the operating system,
and should be avoided when naming files. These characters include
the following:
/ \ " ' * ; - ? [ ] ( ) ~ ! $ { } < > # @ & |
- A file name is hidden from a normal directory listing if it begins with a . (dot). When the ls command is entered with the -a flag, the hidden files are listed along with regular files and directories.
The path name of a file consists of the name of every directory that precedes it in the file tree structure. Only the final component of a path name can contain the name of a regular file. All other components in a path name must be directories. Path names can be absolute or relative. See File path names in Operating system and device management to learn more about the complete name of a file within the file system.