What is the chown command?

QuestionsQuestions8 SkillsProPermissions of FilesSep, 02 2025
0257

The chown command in Linux is used to change the ownership of files and directories. It allows you to modify both the user and group ownership of a specified file or directory. The basic syntax of the command is:

chown [OPTIONS] NEW_OWNER:NEW_GROUP FILE
  • NEW_OWNER specifies the new user who will own the file.
  • NEW_GROUP specifies the new group that will own the file.
  • FILE is the name of the file or directory whose ownership you want to change.

For example, to change the owner of a file named example.txt to the user labex and the group to staff, you would use:

chown labex:staff example.txt

To execute the chown command, you typically need superuser (root) privileges, which can be obtained by prefixing the command with sudo.

0 Comments

no data
Be the first to share your comment!