Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in HDFS

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are the common commands in HDFS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The HDFS command comes in two styles, both of which can be used with the same effect:

Beginning with hadoop fs.

Beginning with hdfs dfs.

How to view help information for hdfs or Hadoop subcommands, such as LS subcommands

Hdfs dfs-help lshadoop fs-help ls # two commands are equivalent

View a list of files in the specified directory in the hdfs file system. Compare the linux command ls

Hdfs dfs-ls / hadoop fs-ls / hdfs dfs-ls-R /

2. Create a file in the hdfs file system

Hdfs dfs-touchz / edits.txthdfs dfs-ls /

3. Append content to HDFS file

Hadoop fs-appendToFile edit1.xml / edits.txt # appends the edit1.xml contents of the current directory on the local disk to the edits.txt text of the HDFS root directory

4. View the contents of the HDFS file

Hdfs dfs-cat / edits.txthdfs dfs-text / edits.txt

5. Upload files to HDFS from the local path

# usage: hdfs dfs-put / local path / hdfs path hdfs dfs-put / linux local disk file / hdfs path file hdfs dfs-copyFromLocal / linux local disk file / hdfs path file # same as put hdfs dfs-moveFromLocal / linux local disk file / hdfs path file # same as put, except that after the source file is copied successfully, it will be deleted

6. Download files in the hdfs file system

Hdfs dfs-get / hdfs path / local path hdfs dfs-copyToLocal / hdfs path / local path # Root get function one

7. Download files in the hdfs file system

Hdfs dfs-get / hdfs path / local path hdfs dfs-copyToLocal / hdfs path / local path # Root get has the same effect

8. Create a directory in the hdfs file system

Hdfs dfs-mkdir / shell

9. Delete files in the hdfs file system

Hdfs dfs-rm / edits.txt deletes the file completely (the deleted file is not put in the trash can of hdfs) how? Hdfs dfs-rm-skipTrash / xcall

10. Modify the file name in the hdfs file system (can also be used to move files to a directory)

Hdfs dfs-mv / xcall.sh / call.shhdfs dfs-mv / call.sh / shell

11. Copy the file to the directory in hdfs

Hdfs dfs-cp / xrsync.sh / shel

Many commands are very similar to linux commands.

Useful = = help==, for example, see the instructions for using the ls command: hadoop fs-help ls

The vast majority of big data frame commands also have similar help information.

This is the end of the content of "what are the commonly used HDFS commands?" Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report