Which command would you use to change file ownership in Linux?

Prepare for the LPI Linux Essentials 010-160 Test. Study with flashcards and multiple choice questions, each question offers hints and explanations. Get ready to ace your exam!

The command used to change file ownership in Linux is indeed 'chown'. This command modifies the ownership of a specified file or directory by allowing you to assign a new user and/or group as the owner.

When you use 'chown', you can specify the username, and optionally the group name, in the format: chown [user][:group] [file]. For instance, if you wanted to change the ownership of a file named 'example.txt' to a user named 'alice', you would use the command chown alice example.txt. Additionally, if you wanted to change both the user and the group, you could do something like chown alice:staff example.txt, where 'staff' is the group name.

The other commands listed serve different purposes. 'chmod' is used to change file permissions, not ownership. 'chgrp' changes the group ownership of a file but does not change the user ownership. Therefore, 'chown' is the correct command for altering the ownership of files and directories.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy