Chown to change the main or owning group of a file
Change file owner: #chown Zek 123.txt (Zek is the name of the owner)
#ls-L 123.txt
-rw-rw-rw-1 Zek Root 12777 December 4 20:31 123.txt
Change file to group such as: #chown: User1 123.txt
# ls-l 123.txt
-rw-rw-rw-1 Zek user1 12777 December 4 20:31 123.txt
Change them together: #chown zek:user1 123.txt or
#chown Zek.user1 123.txt
# ls-l 123.txt
-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt
-R Cascade Change: Change the current directory and all files in the current directory
Example: Chown-r zek.user1 111
Note: The command history shortcut keys are used:
#history View command History
#!ls from the command history from the bottom up to the nearest command that starts with LS and executes
such as #!ls
Ls-l 123.txt
-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt
#!642 the command from the command history with ID bit 642 and executes it.
642 Ls-l 123.txt
643 Chown Root.root 123.txt
#!642
Ls-l 123.txt
-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt
Create owning group: #groupadd groupname
Create User: #useradd Zek
Linux change file owner and owning Group Chown command note