File Attributes

From COMP15212 Wiki
On path: Filing 1: Filing System • 2: File Systems • 3: Files • 4: File Attributes • 5: File Types • 6: File Permissions • 7: File Access • 9: Filing System Implementation • 10: I-nodes • 11: Links • 12: File Descriptor
Depends on FilesSecurity

A file contains data but typically has some associated metadata, or “attributes”. These are things about the file – such as its size – rather than things in the file.

Note: this is ‘permanent’ information about the file; it is not the same as the file descriptor which is the information about a file in use by a particular process.

There are various ways to see file attributes; in Unix an easy way to see some important ones is “ls -l”. You can get more information about a particular file with “stat <filename>”.

Some people may classify “attributes” differently from other metadata properties. (Others don’t.) We won’t bother about such semantics here.

File permissions

If there are any attributes, it is normal to include permission. Permission says what can be done to a file – e.g. can it be written to? This provides some simple protection against clumsy programming, etc.

Unix provides independent control over whether a file can be read, written or executed. There is also some control over who can do what. For example, example files we provide for you must be readable by you, but we only give write permission to the staff!

This system is similar to the system used in memory protection, although it is performed on a ‘user’ rather than a ‘process’ basis.

File ownership

In a multi-user system it is useful to know who ‘owns’ which file. An associated, unique identifier can provide this information. (The user’s name can be looked-up from this if necessary.)

In Unix, a file also belongs to a ‘group’; this allows another access setting for members of that group – typically more liberal than for ‘others’.


Exercise: See some metadata. In a Unix terminal, use the command stat <filename> to see a file’s status. (It works for directories etc. too.) This will reveal quite a lot of information; some of this is explained a bit more in some other articles.


Also refer to: Operating System Concepts, 10th Edition: Chapter 13.1.1, pages 530-531


Articles on Concepts
About this resource • Application Binary Interface (ABI) • Arrays • Atomicity • Boot • Cache • Cacheability • Caching • Concepts • Containers • Context • Context Switching • Deadlock • Direct Memory Access (DMA) • Environment Variables • Exceptions • File Attributes • Fragmentation • Hypervisor • Interrupts • Operation Ordering • PATH • Pointers • Process Scheduling • Processes • Processor Privilege • Queues • Real Time • Reentrancy • Relocatable Code • Spooling and Buffering • Synchronisation • Thrashing • Threads • Virtual Memory • Virtualisation
Articles on User
"Everything is a File" • Application Binary Interface (ABI) • Arrays • Boot • Buffer Overflow • Containers • Daemons • Disk Partition • Dynamic Memory Allocation • Emulator traps • Environment Variables • Errors • Exceptions • File Attributes • File Locking • File Permissions • Introduction to Operating Systems • Journalling File System • Links • Locks • Man(ual pages in Unix) • Memory Mapped Files • Monitoring • Network File System (NFS) • PATH • Pipes • Pointers • Relocatable Code • Reset • SETUID • Shell • Sockets • Spooling and Buffering • Streams • Structures • Superuser • System Calls • Unix Signals • User • Using Peripherals