cheat:chown
# Change a file's owner:
chown <user> <file>
# Change a file's owner and group:
chown <user>:<group> <file>
# Set user to match group value
chown <user>: <file>
# Set group to match user value
chown :<group> <file>
# Change a directory's owner recursively:
chown -R <user> <directory>
# Change ownership to match another file:
chown --reference=<reference-file> <file>
tldr:chown
# chown
# Change user and group ownership of files and directories.
# More information: <https://www.gnu.org/software/coreutils/chown>.
# Change the owner user of a file/directory:
chown user path/to/file_or_directory
# Change the owner user and group of a file/directory:
chown user:group path/to/file_or_directory
# Recursively change the owner of a directory and its contents:
chown -R user path/to/directory
# Change the owner of a symbolic link:
chown -h user path/to/symlink
# Change the owner of a file/directory to match a reference file:
chown --reference=path/to/reference_file path/to/file_or_directory
$
cheat.sh