1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/chown.md

25 lines
679 B
Markdown
Raw Normal View History

2013-12-25 23:59:24 +11:00
# chown
> Change user and group ownership of files and directories.
> More information: <https://www.gnu.org/software/coreutils/chown>.
2013-12-25 23:59:24 +11:00
- Change the owner user of a file/directory:
2013-12-25 23:59:24 +11:00
`chown {{user}} {{path/to/file_or_directory}}`
2013-12-25 23:59:24 +11:00
- Change the owner user and group of a file/directory:
2015-10-22 15:31:52 +08:00
`chown {{user}}:{{group}} {{path/to/file_or_directory}}`
2013-12-25 23:59:24 +11:00
- Recursively change the owner of a directory and its contents:
2013-12-25 23:59:24 +11:00
`chown -R {{user}} {{path/to/directory}}`
2013-12-25 23:59:24 +11:00
- Change the owner of a symbolic link:
2015-10-22 15:31:52 +08:00
2013-12-25 23:59:24 +11:00
`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}}`