HDFS的命令列客戶端常用命令

2021-09-04 04:43:19 字數 2249 閱讀 2871

1.檢視hdfs中的目錄資訊

hadoop fs -ls /hdfs路徑

2.上傳檔案到hdfs中

hadoop fs -put  /本地檔案   /aaa

本地檔案  /hdfs路徑   ##  copyfromlocal等價於 put

hadoop fs -movefromlocal /本地檔案  /hdfs路徑  ## 跟copyfromlocal的區別是:從本地移動到hdfs中

到客戶端本地磁碟

hadoop fs -get /hdfs中的路徑   /本地磁碟目錄

hadoop fs -copytolocal /hdfs中的路徑 /本地磁碟路徑   ## 跟get等價

hadoop fs -movetolocal /hdfs路徑  /本地路徑  ## 從hdfs中移動到本地

4.在hdfs中建立資料夾

hadoop fs -mkdir  -p /aaa/***

5.移動hdfs中的檔案(更名)

hadoop fs -mv /hdfs的路徑  /hdfs的另乙個路徑

6.刪除hdfs中的檔案或資料夾

hadoop fs -rm -r /aaa

7.修改檔案的許可權

hadoop fs -chown user:group /aaa

hadoop fs -chmod 700 /aaa

8.追加內容到已存在的檔案

9.顯示文字檔案的內容

hadoop fs -cat /hdfs中的檔案

hadoop fs -tail /hdfs中的檔案

補充:hdfs命令列客戶端的所有命令列表

usage: hadoop fs [generic options]

[-cat [-ignorecrc] ...]

[-checksum ...]

[-chgrp [-r] group path...]

[-chmod [-r] path...]

[-chown [-r] [owner][:[group]] path...]

[-copyfromlocal [-f] [-p] [-l] [-d] ... ]

[-copytolocal [-f] [-p] [-ignorecrc] [-crc] ... ]

[-count [-q] [-h] [-v] [-t ] [-u] [-x] ...]

[-cp [-f] [-p | -p[topax]] [-d] ... ]

[-createsnapshot ]

[-deletesnapshot ]

[-df [-h] [...]]

[-du [-s] [-h] [-x] ...]

[-expunge]

[-find ... ...]

[-get [-f] [-p] [-ignorecrc] [-crc] ... ]

[-getfacl [-r] ]

[-getfattr [-r] [-e en] ]

[-getmerge [-nl] [-skip-empty-file] ]

[-help [cmd ...]]

[-ls [-c] [-d] [-h] [-q] [-r] [-t] [-s] [-r] [-u] [...]]

[-mkdir [-p] ...]

[-movefromlocal ... ]

[-movetolocal ]

[-mv ... ]

[-put [-f] [-p] [-l] [-d] ... ]

[-renamesnapshot ]

[-rm [-f] [-r|-r] [-skiptrash] [-safely] ...]

[-rmdir [--ignore-fail-on-non-empty] ...]

[-setfacl [-r] [ ]|[--set ]]

[-setfattr ]

[-setrep [-r] [-w] ...]

[-stat [format] ...]

[-tail [-f] ]

[-test -[defsz] ]

[-text [-ignorecrc] ...]

[-touchz ...]

[-truncate [-w] ...]

[-usage [cmd ...]]

Hadoop之hdfs命令列客戶端的常用操作命令

檢視hdfs中的目錄資訊 hadoop fs ls hdfs路徑 hadoop fs ls 建立資料夾 hadoop fs mkdir hdfs路徑 hadoop fs mkdir aaa 移動檔案或重新命名 hadoop fs mkdir hdfs路徑 hdfs路徑 hadoop fs mv aa...

常用 HDFS的Shell 命令列客戶端 操作

2 常用命令 hadoop 安裝目錄 bin 目錄下的 hadoop 指令碼是最基礎的集群管理指令碼,使用者可以通過該指令碼完成各種功能,如 hdfs 檔案管理 mapreduce 作業管理等。hadoop fs mkdir user test 建立hdfs目錄 user test hadoop f...

HDFS的shell 命令列客戶端 操作

cat ignorecrc checksum chgrp r group path.chmod r path.chown r owner group path.copyfromlocal f p copytolocal p ignorecrc crc count q cp f p createsna...