tldr/pages/common/chown.md

24 lines
553 B
Markdown
Raw Normal View History

2013-12-25 16:59:24 +04:00
# chown
2016-02-22 23:07:35 +03:00
> Change user and group ownership of files and folders.
2013-12-25 16:59:24 +04:00
2016-02-23 04:54:19 +03:00
- Change the owner user of a file/folder:
2013-12-25 16:59:24 +04:00
`chown {{user}} {{path/to/file}}`
2016-02-22 23:07:35 +03:00
- Change the owner user and group of a file/folder:
2015-10-22 10:31:52 +03:00
2013-12-25 16:59:24 +04:00
`chown {{user}}:{{group}} {{path/to/file}}`
2016-02-23 04:54:19 +03:00
- Recursively change the owner of a folder and its contents:
2013-12-25 16:59:24 +04:00
`chown -R {{user}} {{path/to/folder}}`
- Change the owner of a symbolic link:
2015-10-22 10:31:52 +03:00
2013-12-25 16:59:24 +04:00
`chown -h {{user}} {{path/to/symlink}}`
2016-02-22 23:07:35 +03:00
- Change the owner of a file/folder to match a reference file:
2016-02-22 23:07:35 +03:00
`chown --reference={{path/to/reference_file}} {{path/to/file}}`