Windows attrib equivalent in Linux
Controls who can read, write, or execute a file. Linux uses a more powerful permission model than Windows.
attrib
chmod / chown
chmod / chown
chmod / chown
Overview
What this command does
On Windows, "attrib" is used to change file permissions/attributes. On Linux, the closest practical mapping shown here is "chmod / chown". Controls who can read, write, or execute a file. Linux uses a more powerful permission model than Windows. This reference is grouped under Security & Permissions → File System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows attrib maps to chmod / chown for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Command-specific caution
Avoid setting permissions to 777 (anyone can do anything) — it's a security risk, especially on web servers.
For the broader concept behind this mapping, read Linux permissions for Windows users.
Practical tasks
Common use cases
Change file permissions/attributes
Controls who can read, write, or execute a file. Linux uses a more powerful permission model than Windows.
chmod 755 file
rwxr-xr-x (typical for scripts)
chmod 644 file
rw-r--r-- (typical for data files)
chmod +x file
Add execute permission for everyone
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
chmod 444 file.txt
chmod 644 file.txt
chmod +x myscript.sh
./myscript.sh
chown john:john file.txt
chown -R john /var/www/
Walkthrough
Examples with explanations
# Windows: attrib +r file.txt (set read-only)
chmod 444 file.txt # read-only for everyone
chmod 644 file.txt # owner can write, others read-only
# Make a script executable:
chmod +x myscript.sh # allow it to be run
./myscript.sh # then run it like this
# Change ownership:
chown john:john file.txt # set owner to john
chown -R john /var/www/ # recursive ownership change
Reference
Common options and variations
| Command or option | Use |
|---|---|
chmod 755 file | rwxr-xr-x (typical for scripts) |
chmod 644 file | rw-r--r-- (typical for data files) |
chmod +x file | Add execute permission for everyone |
chmod -R 755 dir/ | Apply recursively to a directory |
chown user:group file | Change owner and group |
ls -l | View current permissions |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "chmod / chown" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | chmod / chown |
Same command on this distribution. |
| Fedora | same command | chmod / chown |
Same command on this distribution. |
| Arch | same command | chmod / chown |
Same command on this distribution. |
Important
What to watch out for
Keep learning