• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

chown Command Examples in Linux

by admin

The chown command is used to change the owner, the group, or both for a file or directory. At times, you may wish for someone else to manage an object’s permissions other than the user who created that object. You can combine the chown command with the -R option to recursively change ownership through a directory structure.

Syntax

chown command can be used in various ways as shown below:

1. Change owner:

# chown {user name} {file/directory name}

2. Change owner and group:

# chown {user name}:{group name} {file/directory name}

3. Change owner and change group to specified user’s login group:

# chown {user name}: {file/directory name}

4. Change group:

# chown {user name} {file/directory name}

chown Command Examples

1. To change the owner of the file:

# chown mike file.txt 

2. To see if the changes have taken place or not:

# chown -c mike file.txt 

3. To suppress if any error messages:

# chown -f mike file.txt 

4. To apply the changes recursively:

# chown -R mike /mydir 

5. To change the file owner and group at once:

# chown mike:SUPPORT file.txt 

Filed Under: Linux

Some more articles you might also be interested in …

  1. localectl: command not found
  2. iostat Command Examples in Linux
  3. pdfxup: command not found
  4. vgextend Command Examples in Linux
  5. RPM : package installation Error : cpio: read failed
  6. hcitool Command Examples in Linux
  7. jobs: command not found
  8. tune2fs: command not found
  9. dnsrecon Command Examples in Linux
  10. Understanding System Security Services Daemon (SSSD)

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright