chown
Quick Reference
Command Name:
chown
Category:
file ownership
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Ownership management
Change file and directory ownership
- 2
System administration
Manage file ownership for system organization
- 3
User account management
Transfer file ownership between users
- 4
Service account setup
Set ownership for service-specific files
Syntax
chown [OPTION]... [OWNER][:[GROUP]] FILE... chown [OPTION]... --reference=RFILE FILE...
Options
Option | Description |
---|---|
-c, --changes | Like verbose but report only when a change is made |
-f, --silent, --quiet | Suppress most error messages |
-v, --verbose | Output a diagnostic for every file processed |
--dereference | Affect the referent of each symbolic link (default), rather than the symbolic link itself |
-h, --no-dereference | Affect symbolic links instead of any referenced file |
--from=CURRENT_OWNER:CURRENT_GROUP | Change the owner and/or group only if current owner/group match specified values |
--no-preserve-root | Do not treat '/' specially (the default) |
--preserve-root | Fail to operate recursively on '/' |
--reference=RFILE | Use RFILE's owner and group rather than specifying values |
-R, --recursive | Operate on files and directories recursively |
-H | If a command line argument is a symbolic link to a directory, traverse it (with -R only) |
-L | Traverse every symbolic link to a directory encountered (with -R only) |
-P | Do not traverse any symbolic links (default) (with -R only) |
--help | Display help message and exit |
--version | Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the chown
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
chown user1 filename.txt
chown user1:group1 filename.txt
chown :group1 filename.txt
chown user1 file1.txt file2.txt file3.txt
chown 1001:1001 filename.txt