What does "sudo chown -R hadoop:hadoop hadoop" do?

8,154

The command chown changes the ownership of files or directories.

The -R flag makes the command recursive, ie. it is applied to all the files and sub-directories inside given directory.

The string hadoop:hadoop changes the ownership (user:group).

The final hadoop is the name of the directory whose ownership is going to be changed.

Share:
8,154
user785099
Author by

user785099

Updated on September 18, 2022

Comments

  • user785099
    user785099 almost 2 years

    I saw the following script, posted online, that was used during the hadoop installation process.

      sudo tar xzf hadoop-0.20.2.tar.gz
      sudo mv hadoop-0.20.2 hadoop
      sudo chown -R hadoop:hadoop hadoop
    

    I do not quite understand. What does the

        sudo chown -R hadoop:hadoop hadoop
    

    do here? Thanks for the explanation.

    • LiuYan 刘研
      LiuYan 刘研 about 13 years
      it CHange OWNer of hadoop directory and everything under it (-R) to hadoop:handoop (user:group). see the chown manual: linux.die.net/man/1/chown
    • tcoolspy
      tcoolspy about 13 years
      The syntax of linux commands is always listed in the man page. You can look up what any command and it's options by pulling up it's manual like this: man chown.
  • Petr Uzel
    Petr Uzel about 13 years
    For the sake of completeness, I would only add that changing file/directory ownership requires root permissions, therefore the chown command is run with sudo.