A file is a logical storage unit used to store information on a computer. Data is physically stored on disks, but the operating system provides a logical view in the form of files for easier access and management.
- Files are the basic unit of storage.
- The file system in the OS manages and organizes these files.
Each file has characteristics like file name, file type, date (on which file was created), etc. These characteristics are referred to as 'File Attributes'. The operating system associates these attributes with files. In different operating systems files may have different attributes. Some people call attributes metadata also.
Following are some common file attributes:
- Name: File name is the name given to the file. A name is usually a string of characters.
- Identifier: Identifier is a unique number for a file. It identifies files within the file system. It is not readable to us, unlike file names.
- Type: Type is another attribute of a file which specifies the type of file such as archive file (.zip), source code file (.c, .java), .docx file, .txt file, etc.
- Location: Specifies the location of the file on the device (The directory path). This attribute is a pointer to a device.
- Size: Specifies the current size of the file (in Kb, Mb, Gb, etc.) and possibly the maximum allowed size of the file.
- Protection: Specifies information about Access control (Permissions about Who can read, edit, write, and execute the file.) It provides security to sensitive and private information.
- Time, date, and user identification: This information tells us about the date and time on which the file was created, last modified, created and modified by which user, etc.
File AttributesSome Other Attributes May Include:
Attributes related to flags. These Flags control or enable some specific property:
- Read-only flag: 0 for read/write; 1 for read-only.
- Hidden flag: 0 for normal; 1 for do not display in listings of all files.
- System flag: 0 for normal files; 1 for system files.
- Archive flag: 0 for has been backed up; 1 for needs to be backed up.
- ASCII/binary flag: 0 for ASCII file; 1 for binary file.
- Random access flag: 0 for sequential access only; 1 for random access.
- Temporary flag: 0 for normal; 1 for deleted file on process exit.
- Lock flags: 0 for unlocked; nonzero for locked.
Attribute related to keys. These are present in files which can be accessed using key:
- Record length: Number of bytes in a record.
- Key position: Offset of the key within each record.
- Key length: Number of bytes in the key field.
Why File Attributes Matter
File attributes are more than just technical details; they are fundamental to how operating systems manage and protect your data. They enable:
- Security: By making files read-only or encrypted, attributes help protect sensitive data from unauthorized changes or viewing.
- System Stability: Marking critical files as "system" and "hidden" prevents accidental user interaction that could jeopardize the operating system's integrity.
- Data Management: The "archive" attribute streamlines backup processes, while "indexed" files make searching efficient.
- Application Behavior: The "executable" attribute clearly defines which files can be run as programs, distinguishing them from simple data files.
Explore
OS Basics
Process Management
Memory Management
I/O Management
Important Links