Linux Command - chown
chown
- change file owner and group
Syntax
1 | chown [OPTION] [OWNER][:[GROUP]] FILE |
Options
option | description |
---|---|
-R, –recursive | change files and directories recursively |
-v, –verbose | verbose mode |
–reference=RFILE | use RFILE’s owner and group rather than specifying OWNER:GROUP values |
Example
Change file’s owner and group
1 | chown root:adm file1 |
Change file’s group
1 | chown :root file1 |
Change file and directory’s owner and group and print results
1 | chown -v -R root:mail dir |