• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • All
  • About
Linux-Ubuntu | chown -- change file owner and group
  1. Notes
  2. Examples
  3. Command Help (man chown)

  1. Notes
    chown owner[:group] file ...
    
    chown :group file ...

    The chown command changes the owner and/or the group of files and directories.
  2. Examples
    • Change the owner of "folder1" to "user1".
      $ chown user1 folder1/

    • Change the owner of "folder1" (and its files and sub-directories) to "DOMAIN\user2".
      Use the escape character "\" to escape the character "\".
      You can also use the double quote character """ to delimit the folder path to escape the character "\".
      $ chown -R DOMAIN\\user2 folder1/
      
      $ chown -R "DOMAIN\user2" folder1/

    • Change the owner of "folder1" to "user3" and its group to "group3".
      $ chown user3:group3 folder1/

    • Change the group of "folder1" to "group4".
      $ chown :group4 folder1/
  3. Command Help (man chown)
    The following options can be used:
    -R
    |If chown is applied to a directory, it will change the owner/group of this directory and all its files and sub-directories.
    |By default, symbolic links will be changed.
    |But the linked files of symbolic links will not be changed.
    
    -L
    |If the -R option is specified, symbolic links will not be changed.
    |But the linked files of symbolic links will be changed.
    |The -L option overrides any previous -P options.
    |The -L option is ignored unless the -R option is specified.
    
    -P
    |If the -R option is specified, symbolic links will be changed.
    |But the linked files of symbolic links will not be changed.
    |The -P option overrides any previous -L options.
    |The -P option is ignored unless the -R option is specified.
    
    -v
    |Cause chown to be verbose, showing filenames if the owner/group is modified.
© 2025  mtitek