linux创建测试文件

(2)在本地计算机上创建测试文件testfile txt,输入任意5行不少于20个单词。将testfile.txt上传到HDFS目录/uer/data/下,修改文件名称为 Hfile.txt,更改文件权限为所有权,并用HDFS命令显示它的内容;

 

#第一种方法创建
touch testfile.txt
#第二种方法 创建+写入
vim testfile.txt
hello sadasd
hello word 
hello ccc
hello java
hello asdas
aaa bbb
asdsd adasd

#上传至hdfs
hdfs dfs -put testfile.txt /user/data
#修改名字 mv如果没有移动目录则改名 cp也可以
hdfs dfs -mv /user/data/testfile.txt /user/data/Hfile.txt
#更改所有权 -R为递归更改
hdfs dfs -chmod -R 777 /user
#显示
hdfs dfs -cat /user/data/Hfile.txt

 

touch testfile.txt;

vim testfile.txt;

mv testfile.txt  /uer/data/Hfile.txt;