How To Use Chown Command In Linux With Examples?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The chown command is used to change the owner and group of files, directories, and symbolic links in Linux.
Syntax:
chown [OPTIONS] USER[:GROUP] files
Example 1: To change the owner of a file named ‘file1.txt’ to the current user
$ chown file1.txt
Example 2: To change the owner of a file named ‘file1.txt’ to user ‘alice’
$ chown alice file1.txt
Example 3: To change the group of a file named ‘file1.txt’ to the group ‘users’
$ chown :users file1.txt
Example 4: To change the owner and group of a file named ‘file1.txt’ to user ‘alice’ and group ‘users’
$ chown alice:users file1.txt
Example 5: To change the owner and group of all files in the current directory
$ chown -R alice:users .