Hadoop Common Commands Summary

Source: Internet
Author: User
Tags hadoop fs
start HadoopEnter the Hadoop_home directory. Execute SH bin/start-all.sh Turn off HadoopEnter the Hadoop_home directory. Execute SH bin/stop-all.sh

1. View content in the specified directory

Hadoop dfs–ls [File directory]

Eg:hadoop dfs–ls/user/wangkai.pt

2. Open an existing file

Hadoop Dfs–cat [File_path]

Eg:hadoop Dfs-cat/user/wangkai.pt/data.txt

3. Store local files to Hadoop

Hadoop fs–put [Local address] [Hadoop directory]

Hadoop fs–put/home/t/file.txt/user/t

(File.txt is the file name)

4. Store the local folder to Hadoop

Hadoop fs–put [local directory] [Hadoop directory]
Hadoop fs–put/home/t/dir_name/user/t

(Dir_name is the folder name)

5. Down a file on Hadoop to a local existing directory

Hadoop fs-get [File directory] [local directory]

Hadoop fs–get/user/t/ok.txt/home/t

6. Delete specified files on Hadoop

Hadoop fs–rm [File address]

Hadoop fs–rm/user/t/ok.txt

7. Delete the specified folder (including subdirectories, etc.) on Hadoop

Hadoop fs–rm [Directory address]

Hadoop fs–rmr/user/t

8. Create a new directory within the Hadoop specified directory

Hadoop fs–mkdir/user/t

9. Create a new empty file under the Hadoop specified directory

Use the TOUCHZ command:

Hadoop fs-touchz/user/new.txt

10. Renaming a file on Hadoop

Using the MV command:

Hadoop fs–mv/user/test.txt/user/ok.txt (renaming test.txt to Ok.txt)

11. Save all contents of the Hadoop directory as a file and down to the local

Hadoop dfs–getmerge/user/home/t

12. Kill the running Hadoop job

Hadoop Job–kill [Job-id]

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.