permissions
chown
Changes the owner and/or group of files and directories. Requires appropriate privileges (usually root) to reassign ownership.
chown [OPTION]... [OWNER][:[GROUP]] FILE... Common flags
| Flag | Purpose |
|---|---|
| -R | Recurse into directories |
| -h | Affect symlinks themselves, not their targets |
| -v | Print each change |
| -c | Print only files that actually change |
| --reference | Copy owner/group from a reference file |
Examples
chown alice file.txt Change owner to alice
chown alice:devs project/ Set owner and group on a directory
chown -R www-data:www-data /var/www/site Recursively assign a web root to the web-server user
chown --reference=template.conf new.conf Copy owner and group from another file
Gotcha
Following a symlink is the default -- pass -h to change the link itself instead of its target, especially in -R runs.
Related commands
chmod
Changes file mode (permission bits). Accepts symbolic modes like u+x or octal modes like 755.
ls
Lists directory contents including files and subdirectories. Supports detailed views, sorting, and filtering to inspect the filesystem quickly.
find
Recursively walks directories evaluating expressions on each entry. Combines discovery with actions like exec or delete.