• 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 not found

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.

The following example describes how to use this command.

1. Change the owner but not the group.

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

2. Change the owner and the group.

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

3. Changes the owner and the group. The group will be changed to the specified user’s login group.

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

4. Changes the group but not the owner. This is the same as using the chgrp command.

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

You can combine the chown command with the -R option to recursively change ownership through a directory structure.

If you encounter the below error while running the chown command:

chown: command not found

you may try installing the coreutils package as shown below as per your choice of distribution:

Distribution Command
OS X brew install coreutils
Debian apt-get install coreutils
Ubuntu apt-get install coreutils
Alpine apk add coreutils
Arch Linux pacman -S coreutils
Kali Linux apt-get install coreutils
CentOS yum install coreutils
Fedora dnf install coreutils
Raspbian apt-get install coreutils

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 

6. Change the owner of a symbolic link:

# chown -h user path/to/symlink

7. Change the owner of a file/directory to match a reference file:

# chown --reference=path/to/reference_file path/to/file_or_directory

Filed Under: Linux

Some more articles you might also be interested in …

  1. Understanding SELinux File Labelling and SELinux Context
  2. “Read-only locking type set. Write locks are prohibited. Can’t get lock for [volume group]” – error during lvextend
  3. “aws s3 cp” Command Examples
  4. lvreduce Command Examples in Linux
  5. brotli: Compress/uncompress files with Brotli compression
  6. How to Transfer a File In Passive Mode by FTP
  7. ebuild Command Examples in Linux
  8. restorecon Command Examples in Linux
  9. lrunzip Command Examples in Linux
  10. How to Find and Delete Empty Directories and Files in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Chezmoi: A multi-machine dotfile manager, written in Go
  • cheat: Create and view interactive cheat sheets on the command-line
  • chars: Display names and codes for various ASCII and Unicode characters and code points
  • chafa: Image printing in the terminal

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright