← All commands
Topic hub Security & Permissions
Windows Linux Security & Permissions Expanded guide File System

Windows attrib equivalent in Linux

Controls who can read, write, or execute a file. Linux uses a more powerful permission model than Windows.

Windows attrib
→
Linux equivalents
Debian/Ubuntu same command
chmod / chown
Fedora same command
chmod / chown
Arch same command
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.

Migration tip: Linux permissions use <strong>octal numbers</strong> (755, 644) or symbolic notation (u+x). The pattern is: <strong>Owner / Group / Everyone</strong>. 755 = owner can do everything, group and others can read/execute.

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.

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 optionUse
chmod 755 filerwxr-xr-x (typical for scripts)
chmod 644 filerw-r--r-- (typical for data files)
chmod +x fileAdd execute permission for everyone
chmod -R 755 dir/Apply recursively to a directory
chown user:group fileChange owner and group
ls -lView 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Avoid setting permissions to 777 (anyone can do anything) — it's a security risk, especially on web servers.

Keep learning

Related Security & Permissions commands