The shell command provided by Hadoop accomplishes the same task

Source: Internet
Author: User
Tags hdfs dfs

  1. Create a TXT file in the "/home/hadoop/" directory of your local Linux file system, where you can enter some words.
    mkdir hadoopcd Hadooptouch Test.txtgedit test.txt
  2. To view the file location locally (LS)
    Ls-al
  3. Displaying the contents of a file locally
    Cat Test.txt
  4. Use the command to upload "TXT" from the local file system to the input directory of the current user directory in HDFs.
    Cd/usr/local/hadoop./sbin/start-dfs.sh./bin/hdfs dfs-mkdir input./bin/hdfs dfs-put ~/hadoop/test.txt input
  5. View files in HDFs (-ls)
    ./bin/hdfs Dfs-ls
  6. Displays the contents of the file in HDFs
    ./bin/hdfs Dfs-cat Input/test.txt
  7. Delete the local TXT file and view the directory
    Rm-r ~/hadoop/test.txt
  8. From HDFs, download the txt locally to the original location.
    Cd/usr/local/hadoop./sbin/start-dfs.sh./bin/hdfs Dfs-get input/test.txt ~/hadoop
  9. Remove TXT from HDFs and view the directory
    ./bin/hdfs Dfs-rm-r Input/test.txt./bin/hdfs Dfs-ls-r

The shell command provided by Hadoop accomplishes the same task

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.