Hadoop中fs的shell命令例項

2021-08-20 11:19:17 字數 978 閱讀 2430

help [cmd]  //顯示命令的幫助資訊

ls(r) //顯示當前目錄下所有檔案

du(s) //顯示目錄中所有檔案大小

count[-q] //顯示目錄中檔案數量

mv //移動多個檔案到目標目錄

cp //複製多個檔案到目標目錄

rm(r)  //刪除檔案(夾)

put //本地檔案複製到hdfs

copyfromlocal  //同put

movefromlocal  //從本地檔案移動到hdfs

get [-ignorecrc] //複製檔案到本地,可以忽略crc校驗

getmerge //將源目錄中的所有檔案排序合併到乙個檔案中

cat //在終端顯示檔案內容

text //在終端顯示檔案內容

copytolocal [-ignorecrc] //複製到本地

movetolocal

mkdir //建立資料夾

touchz //建立乙個空檔案

#hadoop fs -ls /  檢視hdfs根目錄

#hadoop fs -mkdir /test 在根目錄建立乙個目錄test

#hadoop fs -mkdir /test1 在根目錄建立乙個目錄test1

#hadoop fs -put ./test.txt /test 

或#hadoop fs -copyfromlocal ./test.txt /test

#hadoop fs -get /test/test.txt .

或#hadoop fs -gettolocal /test/test.txt .

#hadoop fs -cp /test/test.txt /test1

#hadoop fs -rm /test1/test.txt

#hadoop fs -mv /test/test.txt /test1

#hadoop fs -rmr /test1  

hadoop連線方式配置 fs操作 put

cat core site.xml cat yarn site.xml cat hdfs site.xml 多個檔案合併cat 選擇啟動哪種配置模式 ln s hadoop pseudo hadoop 前提是剔除環境變數 export hadoop conf dir 剔除環境變數 建立使用者目錄 h...

awk中FS的指定

awk之fs的指定 file fan1 11h ok 160.96 11139 rpm fan2 12h ok 160.96 rpm fan3 13h ok 160.96 10763 rpm fan4 14h ok 160.96 10998 rpm fan5 15h ok 160.96 11515 ...

NodeJs中的fs模組

const fs require fs 1.fs.stat 檢測是檔案還是目錄 fs.stat package.json err,data console.log 檔案 console.log 目錄 2.fs.mkdir 建立目錄 fs.mkdir css err console.log 建立成功 ...