• Operating System Video Tutorials

File Attributes in Operating System



A file stores content or information on a disk. It is the smallest unit for storing data, and without files, it is impossible to store any information on a system.

In addition to storing data, a file also possesses attributes that provide metadata or details about the file itself. These attributes play an essential role in managing and handling files, regardless of their content.

What is File Attributes in Operating System?

File attributes are the special parameters that are used to store the metadata of the specified file. Here, metadata is data which provides the information about the file rather than the content of the file. It specifies the behaviour, characteristics, and properties of the file, which helps operating system and users how to manage files.

The attributes of files are used to manage the visibility, access and other functionalities of the file. It can also provide information about the file, like when it was created, last modified, or last accessed.

We can modify the attributes of the file according to the operating system, for example, if we are using Windows, then we can modify the attributes of the file by right click on the file, then select properties, and then we can modify the attributes. If we are using macOS, then right-click on the file and then select the get info option to set the file attributes.

Different Types of File Attributes in OS

Operating system provides a variety of attributes for a file. Using these attributes, we can specify the properties of the stored file so that we can access it very easily. The attributes supported by the operating system are as follows:

  • Name: The name attribute is used to store the name of the file. It is of string type and provides unique and human read identity to the specififed file. It prevents users from saving files with duplicate names.

  • Identifier:The identifier attribute is used to store the extension of the file. It specifies what type of data is stored in the given file. The most commonly used file extensions are − .txt, .mp4, .jpg, etc.

  • Types: The Type attribute is also used to specify the type of the file such as zip file, audio file, video file, etc.

  • Location: The location attributed is used to specify the location of the file. Or we can say that it is used to specify the directory path so that we can easily locate the file.

  • Size: The size attribute is used to specify the size of the file in Kb, Mb, etc.

  • Protection:The protection attribute is used to provide information about the access control of the file. It is commonly used to provide security to the given file by applying the permissions. Using this, we can control who can read, write, and execute files.

  • Time and date: This attribute is used to provide information about when and at what time the file is created or modified.

  • Read-only Flag: The read-only flag determines whether the file is read-only or not. If the value of this file is set to 0, it means that the file can be read or written. Or if the value of the flag is set to 1, then that means the flag is read-only.

  • Hidden Flag: The hidden flag determines whether the file is hidden from the normal directory or not.

  • System Flag: The system flag is used to mark the file as a system file. It is hidden from the regular user to avoid modifications. It is only used by the operating system.

  • Archive Flag: The archive flag is used to mark the file as a needing system.

  • ASCII/Binary Flag: The ASCII/Binary flag is used to specify the format of the file content either in ASCII mode or Binary mode. If the value of this flag is 1, then that means the file is an ASCII file. Otherwise, the file is binary.

  • Random Access Flag: The random access flag allows the user to directly access any part of the file. It allows random read and write operations.

  • Temporary Flag: The temporary flag marks the specified file temporarily and can be deleted after it's used. It is commonly used for temporary storage or caching.

  • Lock Flag: The lock flag is used to lock the file. It keeps files from multiple access. If the value of this flag is 0, then that means the file is unlocked, it is not.

Advertisements