To change file attributes in Windows, right-click the file, select Properties, and
check or uncheck the boxes for Read-only or Hidden at the bottom of the General tab. Click Apply, then
OK. For Mac and Linux, use terminal commands like chmod or chflags to control
file permissions and visibility.
File attributes are special tags that control how your computer treats each file. They decide whether you can edit a file, whether it shows up in folder listings, and whether backup programs should copy it. Knowing how to change these settings helps you protect important documents, hide sensitive files, or fix errors when files won't open or save properly.
What Each File Attribute Does
Before changing attributes, it helps to know what each one controls. Windows uses four main attributes that you'll work with most often:
| Attribute | What It Does | Common Uses |
|---|---|---|
| Read-only (R) | Stops programs from changing or deleting the file | Protect finished documents, prevent accidental edits |
| Hidden (H) | Makes the file invisible in normal folder views | Keep personal files private, reduce folder clutter |
| System (S) | Marks the file as important for Windows to run | Used by Windows for boot files and core system files |
| Archive (A) | Tells backup software the file changed since the last backup | Helps backup programs know which files need copying |
The NTFS file system in Windows also supports extended attributes like compression and encryption, which you can find by clicking the Advanced button in the Properties window.
Windows: Using the Properties Window
The fastest way to change attributes on one or a few files is through the right-click menu. This method works in Windows 10, Windows 11, and older versions.
- Open File Explorer and find your file
- Right-click the file and select Properties
- Look at the bottom of the General tab for the Attributes section
- Check the box next to Read-only to protect the file from changes
- Check the box next to Hidden to make the file invisible
- Click Apply, then OK
To change attributes on multiple files at once, select all the files first by holding Ctrl while clicking each one. Then right-click and choose Properties. Any changes you make will apply to every selected file.
Accessing Advanced Attributes
Click the Advanced button in the Properties window to find more options. Here you can turn on file compression to save disk space, or enable encryption to protect the file with your Windows account password. These features only work on drives formatted with NTFS, which is the default for most Windows computers.
Windows: Using the Command Prompt
The attrib command gives you more control and works faster when you need to change many
files. It also lets you modify the System attribute, which doesn't appear in the Properties window.
To open Command Prompt, press the Windows key, type cmd, and press Enter. Then use these commands:
attrib +r filename.txt (add read-only)
attrib -r filename.txt (remove read-only)
attrib +h filename.txt (hide the file)
attrib -h filename.txt (show the file)
attrib +s filename.txt (mark as system file)
attrib +a filename.txt (set archive flag)
You can combine multiple changes in one command. For example, attrib +r +h important.docx
makes a file both read-only and hidden at the same time.
Changing Attributes on Multiple Files
Use wildcards to work with many files at once. The asterisk (*) matches any characters in a filename:
attrib +r *.docxmakes all Word documents read-onlyattrib -h *.*unhides every file in the current folderattrib +r /s /dapplies read-only to all files and subfoldersattrib -r -h "C:\Users\Name\Documents\*.*"removes attributes from all files in a specific folder
The /s flag includes all subfolders, and /d applies changes to folders
themselves, not just the files inside them.
Warning: Changing attributes on files in the Windows folder, System32, or Program Files can cause serious problems. These folders contain files that Windows needs to run. Always create a backup or system restore point before modifying system files.
Mac: Finder and Terminal Methods
macOS handles file attributes differently than Windows. The Finder app lets you lock files and change permissions, while Terminal gives you full control over visibility and other settings.
Using Finder to Lock Files
- Right-click (or Control-click) the file
- Select Get Info
- Check the Locked box to prevent changes
- Expand Sharing & Permissions to control who can read or write the file
Hiding Files on Mac
The Finder doesn't have a simple "hide" checkbox like Windows. Instead, you have two options:
- Rename the file to start with a period (for example, rename "budget.xlsx" to ".budget.xlsx"). Files starting with a dot are hidden by default on Mac and Linux systems.
- Use Terminal with the command
chflags hidden filenameto hide without renaming.
To show hidden files in Finder, press Command + Shift + Period on your keyboard.
This tradition goes back to the early Unix operating system from the 1970s. The programmers who
created the ls command (which lists files) wanted to hide the "." and ".." directory
entries that appear in every folder. They took a shortcut and made the program skip any filename
starting with a period. Users quickly discovered they could hide their own files the same way, and
the convention stuck. Every Unix-based system, including macOS and Linux, still follows this rule
today.
Terminal Commands for Mac
Open Terminal from Applications, then Utilities, or search for it using Spotlight. These commands control file attributes:
chflags hidden filename (hide the file)
chflags nohidden filename (show the file)
chflags uchg filename (make unchangeable)
chflags nouchg filename (allow changes again)
chmod 444 filename (read-only for everyone)
chmod 644 filename (you can edit, others can read)
Linux: Using chmod and chattr
Linux gives you the most control over file attributes. The chmod command handles basic
permissions, while chattr sets special flags that even restrict root users.
Understanding chmod Numbers
The chmod command uses numbers to set permissions. Each digit represents permissions for a
different group: owner, group, and everyone else. The numbers mean:
- 4 = read permission
- 2 = write permission
- 1 = execute permission (run as a program)
Add these numbers together for combinations. For example, 6 means read plus write (4+2), and 7 means read, write, and execute (4+2+1).
chmod 644 filename (owner: read/write, others: read only)
chmod 444 filename (everyone: read only)
chmod 755 filename (owner: full access, others: read/execute)
chmod +x script.sh (add execute permission)
chmod -w filename (remove write permission)
Using chattr for Special Attributes
The chattr command sets attributes that go beyond normal permissions. You'll need to use
sudo for most of these:
sudo chattr +i filename (immutable: nobody can change or delete)
sudo chattr -i filename (remove immutable flag)
sudo chattr +a filename (append only: can add but not edit)
lsattr filename (show current attributes)
The immutable flag (+i) provides strong protection because even the root user cannot modify
or delete the file without first removing the flag. This makes it useful for protecting critical
configuration files.
Fixing Common Attribute Problems
Sometimes files get stuck with attributes you can't change through normal methods. Here are solutions for the most common problems:
File Stays Read-only Even After Unchecking the Box
Another program might have the file open. Close all programs that might be using the file and try again.
If that doesn't work, open Command Prompt and run attrib -r filename to force the change.
Cannot Find Hidden Files
In Windows 10 and 11, open File Explorer, click the View tab, and check Hidden items. In older Windows versions, go to Folder Options, then the View tab, and select "Show hidden files, folders, and drives."
Access Denied When Changing Attributes
You need administrator rights. On Windows, right-click Command Prompt and select Run as
administrator. On Mac or Linux, add sudo before your command.
Cannot Change Files on a USB Drive or Network Location
Some USB drives use the FAT32 file system, which doesn't support all attributes. Network drives may have their own permission systems controlled by the server. Check with your network administrator if you can't change files on a shared drive.
Do File Attributes Provide Security?
File attributes control convenience, not security. The Read-only attribute prevents accidental changes, but anyone with admin rights can remove it in seconds. Hidden files stay hidden only until someone turns on "show hidden files" in their folder settings.
For real security, use these methods instead:
- File encryption scrambles the contents so only you can read them
- User account permissions control who can access folders
- BitLocker or FileVault encrypts your entire drive
- Password-protected archives keep files safe when sharing
The Linux immutable flag (chattr +i) comes closest to real protection because even root
cannot change the file without removing the flag first. Windows has no equivalent that's as strong.
Moving Files Between Operating Systems
When you copy files between Windows, Mac, and Linux, some attributes transfer and others don't:
- Read-only usually transfers correctly between all systems
- Hidden works differently on each system, so hidden files may become visible when moved
- NTFS compression and encryption only work on Windows and will decompress when copied to Mac or Linux
- Linux permissions don't exist on FAT32 or exFAT drives, so they reset when copying to USB drives formatted with these file systems
If you move files between systems often, check the attributes after copying to make sure they're set the way you want.
For more ways to keep your files organized and your computer running well, see these computer maintenance tips.