Hadoop(三)命令指南

概览

  All HDFS commands are invoked by the bin/hdfs script. Running the hdfs script without any arguments prints the description for all commands.
  Usage: hdfs [SHELL_OPTIONS] COMMAND [GENERIC_OPTIONS] [COMMAND_OPTIONS]

       官网地址

实例:上传文件到hdfs

-- 创建文件
[root@VM-75-149-centos file]# echo 'hello world!' > hello.text
[root@VM-75-149-centos file]# ls
hadoop-2.10.1.tar.gz  hello.text
[root@VM-75-149-centos file]# cat hello.text 
hello world!
-- hdfs创建多级目录
[root@VM-75-149-centos file]# hdfs dfs -mkdir -p /2022/05/
-- hdfs查询文件目录
[root@VM-75-149-centos file]# hdfs dfs -ls /       
Found 1 items
drwxr-xr-x   - root supergroup          0 2022-05-05 15:23 /2022
-- 上传文件到hdfs
[root@VM-75-149-centos file]# hdfs dfs -put hello.text /2022/05/ 
-- hdfs查询文件
[root@VM-75-149-centos file]# hdfs dfs -ls /2022/05/            
Found 1 items
-rw-r--r--   1 root supergroup         13 2022-05-05 15:26 /2022/05/hello.text

通过web查看上传的文件信息

 

posted @ 2026-03-20 12:25  鄙人取个名字好难  阅读(1)  评论(0)    收藏  举报