# The Linux Chown Dance: Mastering r, -R, and --recursive
The r in Chown: Resetting Permissions
When you're dancing with `chown`, the `r` option is your partner for resetting permissions. After changing the owner, `r` ensures that the permissions revert to the default for the new owner's group. It's like giving your file a fresh start.
Syntax: chown -r newowner filename
chown -r jane myfile.txt
The -R and --recursive Twins: Conquering Directories
Now, let's meet `-R` and its alias, `--recursive`. These twins are perfect for changing ownership across entire directories, including subdirectories and files. It's a one-command conquer!
Syntax: chown -R --recursive newowner directory
chown -R --recursive jane /path/to/directory
The Power of Combination: r, -R, and --recursive Together
When you combine `r`, `-R`, and `--recursive`, you've got a power trio that changes ownership and resets permissions across entire directories and their contents. It's the ultimate `chown` dance!
Syntax: chown -R --recursive -r newowner directory
chown -R --recursive -r jane /path/to/directory
Real-World Example: Maintaining Group Permissions
Let's say you're managing a web server, and you want to change the owner of your HTML files to the web server user (`www-data`). However, you want to maintain the group permissions for the web server group (`www-data`). Here's how you'd do it:
chown -R --recursive -r www-data /var/www/html
Source: DigitalOcean: Understanding Linux File Permissions
Your Command-Line Conquest Awaits
Now that you've mastered the `r`, `-R`, and `--recursive` options, it's time to take control of your Linux file permissions. Start dancing with `chown` today, and watch your command-line conquest unfold!