← All commands
Topic hub Security & Permissions
Windows Linux Security & Permissions 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

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

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

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

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

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