(0) Start Hadoop cluster
sbin/start-dfs.sh
sbin/start-yarn.sh
(1) -help: output of this command parameter
hadoop fs -help rm
(2) -ls: display directory information
Hadoop fs -Ls /
(3) -mkdir: Create a directory on HDFS
hadoop fs -mkdir -p / sanguo / shuguo
(4) -moveFromLocal: Paste cut from the local to the HDFS
touch kongming.txt
hadoop fs -moveFromLocal ./kongming.txt / sanguo / shuguo
(5) -appendToFile: Append a file to the end of the file already exists
touch liubei.txt
vi liubei.txt
Entry
san gu mao lu
hadoop fs -appendToFile liubei.txt /sanguo/shuguo/kongming.txt
(6) -cat: display file contents
hadoop fs -cat /sanguo/shuguo/kongming.txt
(7) -chgrp, -chmod, -chown: Like Linux file system usage permissions to modify the file belongs
hadoop fs -chmod 666 /sanguo/shuguo/kongming.txt
hadoop fs -chown angel:angel /sanguo/shuguo/kongming.txt
(8) -copyFromLocal: from the local file system to copy files to HDFS path
hadoop fs -copyFromLocal README.txt /
(9) -copyToLocal: copied from the local to HDFS
hadoop fs -copyToLocal /sanguo/shuguo/kongming.txt ./
(10) -cp: HDFS copied from one path to another path of HDFS
hadoop fs -cp /sanguo/shuguo/kongming.txt /zhuge.txt
(11) -mv: moving files in HDFS directory
hadoop fs -mv /zhuge.txt / sanguo / shuguo /
(12) -get: equivalent to copyToLocal, it is to download files from HDFS to the local
hadoop fs -get /sanguo/shuguo/kongming.txt ./
(13) -getmerge: merge multiple files to download, for example, there are multiple files in HDFS directory / user / atguigu / test: log.1, log.2, log.3, ...
hadoop fs -getmerge /user/angel/test/* ./zaiyiqi.txt
(14) -put: equivalent to copyFromLocal
hadoop fs -put ./zaiyiqi.txt /user/angel/test/
(15) -tail: appears at the end of a file
hadoop fs -tail /sanguo/shuguo/kongming.txt
(16) -rm: delete a file or folder
hadoop fs -rm /user/angel/test/jinlian2.txt
(17) -rmdir: Delete empty directory
hadoop fs -mkdir /test
hadoop fs -rmdir /test
Size information (18) -du statistics folder
hadoop fs -du -s -h /user/angel/test
hadoop fs -du -h /user/angel/test
(19) -setrep: Set the number of copies of the files in HDFS
hadoop fs -setrep 10 /sanguo/shuguo/kongming.txt