- 檢視環境變量
hadoop fs
- 檔案可視化浏覽
-
- 打開虛拟機中的火狐浏覽器
-
-
- 網址: http://localhost:50070
- 打開
下的Utilities
Browse the file system
-
-
- 電腦中的浏覽器
-
-
- http://虛拟機的ip位址:50070
-
Utilities
Browse the file system
-
- 指令行檢視檔案
hadoop fs -ls /
将檔案從本地上傳到Hadoop
- 在本地建立一個名為
的txt檔案dashuju
touch dashuju.txt
- 修改檔案内容
-
-
進入檔案vim
-
vim dashuju.txt
-
-
輸入内容i
-
退出編輯Esc
-
儲存:wq
-
檢視檔案内容cat
cat dashuju.txt
- 在hadoop中建立檔案夾
hadoop fs -mkdir -p /taigong/test
-
- 根目錄 > taigong > test
- 将檔案上傳到建立的檔案夾中
文法:
hadoop fs -put 需上傳的檔案路徑 上傳到的檔案夾路徑
示例:
hadoop fs -put dashuju.txt /taigong/test
- 檢視檔案及其内容
檢視檔案:
hadoop fs -ls /taigong/test
檢視内容:
hadoop fs -cat /taigong/test/dashuju.txt
将檔案從Hadoop下載下傳到本地
- 下載下傳到本地并命名為
Haha
文法:
hadoop fs -get 需要下載下傳的檔案路徑 下載下傳後的檔案路徑
示例:
hadoop fs -get /taigong/test/dashuju.txt Haha.txt
移動檔案
- 從
移動到根目錄>taigon>test
根目錄>user
文法:
hadoop fs -mv 需要移動的檔案路徑 移動後的檔案夾路徑
示例:
hadoop fs -mv /taigong/test/dashuju.txt /user
删除檔案
- 将檔案夾
删除taigong
文法:
hadoop fs -rm -r 需要删除的檔案
示例:
hadoop fs -rm -r /taigong