标签:bin oop 文件相关 The shel star 目录 常用 cal
一、Hadoop提供的Shell命令完成相同任务:
cd /home/hadoop touch wzh.txt ls /home/hadoop cat wzh.txt ./sbin/start-dfs.sh ./bin/hdfs dfs -mkdir -p /user/hadoop ./bin/hdfs dfs -mkdir input ./bin/hdfs dfs -put ./wzh.txt input ./bin/hdfs dfs -ls input ./bin/hdfs dfs -ls /input ./bin/hdfs dfs -cat input/wzh.txt cd hadoop rm -r wzh.txt ls -al ./bin/hdfs dfs -get /input/wzh.txt ~/hadoop ./bin/hdfs dfs -rm input/wzh.txt ./bin/hdfs dfs -ls input
二、
hadoop fs -put /home/hadoop/wzh.txt /usr/local/hadoop hadoop fs -test -e /usr/local/hadoop/wzh.txt if $(hadoop fs -test -e /home/hadoop/wzh.txt); <br>then $(hadoop fs -copyToLocal /usr/local/hadoop/wzh.txt /home/hadoop/wzh.txt);<br>else $(hadoop fs -copyToLocal /usr/local/hadoop/wzh.txt /home/hadoop/wzh2.txt); fi hadoop dfs -cat /usr/local/hadoop/wzh.txt hadoop dfs -ls -h /usr/local/hadoop/wzh.txt hadoop dfs -ls -R -h /usr/local/hadoop if $(hadoop dfs -test -d /usr/local/hadoop/test); then $(hadoop dfs -touch /usr/local/hadoop/test/wzh1.txt); else $(hadoop dfs -mkdir -p /usr/local/hadoop/test && hadoop dfs -touch /usr/local/hadoop/test/wzh1.txt); fi hadoop dfs -rm -r /usr/local/hadoop/test hadoop dfs -rm /usr/local/hadoop/wzh.txt hadoop dfs -rmr /usr/local/hadoop hadoop fs -mv /usr/local/hadoop/wzh.txt /usr/local/hadoop/hadoop_tmp/wzh.txt
标签:bin oop 文件相关 The shel star 目录 常用 cal
原文地址:https://www.cnblogs.com/BOBOWZH/p/8951714.html