RHEL Linux - Red Hat System Administration Practice Exam

Disable ads (and more) with a membership for a one time $4.99 payment

Study for the RHEL Linux - Red Hat System Administration Exam. Enhance your knowledge with flashcards and multiple-choice questions, complete with hints and explanations. Prepare for your certification!

Practice this question and more.


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

  1. chown

  2. chmod

  3. chgrp

  4. rename

The correct answer is: chown

To change the ownership of a file in Linux, the appropriate command to use is "chown." This command enables users to change the owner of a file or directory, along with the group associated with that file or directory if specified. The syntax typically looks like this: "chown new_owner:new_group filename" or just "chown new_owner filename" if you only want to change the owner. Using "chmod" is related but serves a different purpose; it is used to change the permissions of a file or directory, not the ownership. "chgrp" specifically changes the group ownership of a file, which is a different aspect of file ownership. "rename" is related to changing the name of a file and does not affect ownership at all. Thus, "chown" is the correct command for changing the ownership of files and directories in the Linux system as it directly addresses the ownership attribute of the files.