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.

  • 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 Jun 24 '11 at 1:38
  • 1
    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.
    – Caleb
    Jun 24 '11 at 6:37

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.

  • 1
    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.
    – Petr Uzel
    Jun 24 '11 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.