Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 DOS and Windows  





2 Unix and POSIX  



2.1  4.4BSD and derivatives  





2.2  Linux  





2.3  OpenSolaris and derivatives  







3 See also  





4 References  





5 External links  














File attribute






Čeština
Dansk
Deutsch
فارسی

Bahasa Indonesia
עברית
Polski
Русский
Suomi
Українська
Tiếng Vit

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


File attributes are a type of meta-data that describe and may modify how files and/or directories in a filesystem behave. Typical file attributes may, for example, indicate or specify whether a file is visible, modifiable, compressed, or encrypted. The availability of most file attributes depends on support by the underlying filesystem (such as FAT, NTFS, ext4) where attribute data must be stored along with other control structures. Each attribute can have one of two states: set and cleared. Attributes are considered distinct from other metadata, such as dates and times, filename extensionsorfile system permissions. In addition to files, folders, volumes and other file system objects may have attributes.

DOS and Windows[edit]

Traditionally, in DOS and Microsoft Windows, files and folders accepted four attributes:[1][2][3]

As new versions of Windows came out, Microsoft has added to the inventory of available attributes on the NTFS file system,[7] including but not limited to:[8]

Other attributes that are displayed in the "Attributes" column of Windows Explorer[7] include:

In DOS, OS/2 and Windows, the attrib command in cmd.exe and command.com can be used to change and display the four traditional file attributes.[3][9] File Explorer in Windows can show the seven mentioned attributes but cannot set or clear the System attribute.[5] Windows PowerShell, which has become a component of Windows 7 and later, features two commands that can read and write attributes: Get-ItemProperty and Set-ItemProperty.[10] To change an attribute on a file on Windows NT, the user must have appropriate file system permissions known as Write Attributes and Write Extended Attributes.[11]

Unix and POSIX[edit]

InUnix and Unix-like systems, including POSIX-conforming systems, each file has a 'mode' containing 9 bit flags controlling read, write and execute permission for each of the file's owner, group and all other users (see File-system permissions §Traditional Unix permissions for more details) plus the setuid and setgid bit flags and a 'sticky' bit flag. The mode also specifies the file type (regular file, directory, or some other special kind).

4.4BSD and derivatives[edit]

In4.4BSD and 4.4BSD-Lite, files and directories (folders) accepted four attributes that could be set by the owner of the file or the superuser (the "User" attributes) and two attributes that could only be set by the superuser (the "System" attributes):[12]

FreeBSD added some additional attributes,[13] also supported by DragonFly BSD:[14]

FreeBSD also supports:[13]

whereas DragonFly BSD supports:[14]

NetBSD added another attribute,[15] also supported by OpenBSD:[16]

macOS added three attributes:

In these systems, the chflags and ls commands can be used to change and display file attributes. To change a "user" attribute on a file in 4.4BSD-derived operating systems, the user must be the owner of the file or the superuser; to change a "system" attribute, the user must be the superuser.

Linux[edit]

The Linux operating system can support a wide range of file attributes that can be listed by the lsattr command and modified, where possible, by the chattr command. Programs can examine and alter attributes using ioctl operations.[18]

Many Linux file systems support only a limited set of attributes, and none of them support every attribute that chattr can change. File systems that support at least some attributes include ext4, XFS and btrfs.

Common file attributes supported by many common Linux file systems
Attribute lsattr flag chattr option Semantics and rationale
Noatime updates A +A,-A atime record is not modified when file is read/accessed.
Append-only a +a,-a

Writing to file only allowed in append mode.

Immutable i +i,-i

Prevents any change to file's contents or metadata: file/directory cannot be written to, deleted, renamed, or hard-linked.

No dump d +d,-d File is skipped by the dump program
Secure deletion s +s,-s Requests that, when deleted, all file data blocks are filled with zeroes.
Synchronous updates S +S,-S Changes are written synchronously to the underlying filesystem storage medium; equivalent to 'sync' mount option for affected files.

OpenSolaris and derivatives[edit]

Support for "system attributes" (in which the operating system defines the meaning, unlike general extended file attributes) was added to OpenSolaris in 2007 in support of the CIFS server.[19] It has been carried forward from there into both the Oracle Solaris 11 releases and the open source illumos project.

In this implementation, a wide range of attributes can be set via the chmod command[20][21] and listed by the ls command.[22][23] Programs can examine and alter attributes using the getattrat and setattrat functions.[24][25]

Currently the ZFS file system supports all defined attributes, and starting in Oracle Solaris 11.2, the tmpfs file system supports a subset of attributes.[26]

Common file attributes supported by Oracle Solaris and illumos systems
Attribute Compact flag for ls & chmod Semantics and rationale
appendonly a

Writing to file only allowed in append mode.

immutable i

Prevents any change to file's contents or metadata (except access time): file/directory cannot be written to, deleted, or renamed.

nodump d File should be skipped by backup programs
nounlink u Prevents removing the file, but allows other changes.

See also[edit]

References[edit]

  1. ^ "Definition of: file attribute". PC Magazine. Ziff Davis. Retrieved 14 October 2020.
  • ^ "File attributes". Computer Hope. Retrieved 2 December 2012.
  • ^ a b "In Windows, what are file attributes, and how can I change them?". Knowledge Base. Indiana University. 11 October 2011. Retrieved 2 December 2012.
  • ^ "What is a hidden file?". Windows 7 Help. Microsoft. Retrieved 2 December 2012.
  • ^ a b "You cannot view or change the Read-only or the System attributes of folders in Windows Server 2003, in Windows XP, in Windows Vista or in Windows 7". Microsoft Support. Microsoft. 31 May 2012. Retrieved 2 December 2012.
  • ^ "Why is the readonly property on folders so strange?".
  • ^ a b "File Attribute Constants". MSDN. Microsoft. Retrieved 17 July 2018.
  • ^ "HOW TO: Use the File Attribute Management Script (Fileattributes.pl) in Windows 2000". Microsoft support. Microsoft. Retrieved 2 December 2012.
  • ^ "Definition of: DOS Attrib". PC Magazine. Ziff Davis. Archived from the original on 2 March 2012. Retrieved 2 December 2012.
  • ^ "Use a PowerShell Cmdlet to Work with File Attributes". Hey, Scripting Guy! Blog. Microsoft. 26 January 2011. Retrieved 3 December 2012.
  • ^ "How to set, view, change, or remove special permissions for files and folders in Windows XP". Microsoft Support. Microsoft. 7 May 2007. Retrieved 2 December 2012.
  • ^ chflags(2) – BSD System Calls Manual
  • ^ a b chflags(2) – FreeBSD System Calls Manual
  • ^ a b chflags(2) – DragonFly BSD System Calls and Error Numbers Manual
  • ^ chflags(2) – NetBSD System Calls Manual
  • ^ chflags(2) – OpenBSD System Calls Manual
  • ^ chflags(2) – Darwin and macOS System Calls Manual
  • ^ ioctl_iflags(2) – Linux Programmer's Manual – System Calls
  • ^ Shellenbaum, Mark. "Extensible Attribute Interfaces [PSARC/2007/315]". OpenSolaris ARC Material Archive. illumos.org. Retrieved 10 March 2023.
  • ^ "chmod(1)". Oracle Solaris 11.4 Reference Library: man pages section 1: User Commands. Oracle. Retrieved 10 March 2023.
  • ^ "chmod(1)". illumos man pages. illumos.org. Retrieved 10 March 2023.
  • ^ "ls(1)". Oracle Solaris 11.4 Reference Library: man pages section 1: User Commands. Oracle. Retrieved 10 March 2023.
  • ^ "ls(1)". illumos man pages. illumos.org. Retrieved 10 March 2023.
  • ^ "getattrat(3c)/setattrat(3c)". Oracle Solaris 11.4 Reference Library: man pages section 3: Basic Library Functions. Oracle. Retrieved 10 March 2023.
  • ^ "getattrat(3c)/setattrat(3c)". illumos man pages. illumos.org. Retrieved 10 March 2023.
  • ^ "sysattr(7)". Oracle Solaris 11.4 Reference Library: man pages section 7. Oracle. Retrieved 10 March 2023.
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=File_attribute&oldid=1218401373"

    Category: 
    Computer file systems
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
    Webarchive template wayback links
     



    This page was last edited on 11 April 2024, at 14:28 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki