标签:ado cal 开头 查看 使用命令 递归 目的 mkdir sbin
一、Hadoop提供的Shell命令完成相同任务:
1.在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词.
mkdir hadoop cd hadoop ~/hadoop$ touch test.txt ~/hadoop$ gedit test.txt
2.在本地查看文件位置(ls)
ls -al
3.在本地显示文件内容
cat test.txt
4.使用命令把本地文件系统中的“txt”上传到HDFS中的当前用户目录的input目录下。
~$ cd /usr/local/hadoop /usr/local/hadoop$ ./sbin/start-dfs.sh /usr/local/hadoop$ ./bin/hdfs dfs -mkdir input /usr/local/hadoop$ ./bin/hdfs dfs -put ~/hadoop/test.txt input
5.查看hdfs中的文件(-ls)
./bin/hdfs dfs -ls
6.显示hdfs中该的文件内容
./bin/hdfs dfs -cat input/test.txt
7.删除本地的txt文件并查看目录
cd ~ cd ~/hadoop rm -r test.txt ls -al
8.从hdfs中将txt下载地本地原来的位置。
cd ~ cd /usr/local/hadoop ./sbin/start-dfs.sh ./bin/hdfs dfs -get input/test.txt ~/hadoop
9.从hdfs中删除txt并查看目录
./bin/hdfs dfs -rm -r input/test.txt ./bin/hdfs dfs -ls
二、
一、Hadoop提供的Shell命令完成相同任务:
mkdir hadoop cd hadoop ~/hadoop$ touch test.txt ~/hadoop$ gedit test.txt
ls -al
cat test.txt
~$ cd /usr/local/hadoop /usr/local/hadoop$ ./sbin/start-dfs.sh /usr/local/hadoop$ ./bin/hdfs dfs -mkdir input /usr/local/hadoop$ ./bin/hdfs dfs -put ~/hadoop/test.txt input
./bin/hdfs dfs -ls
./bin/hdfs dfs -cat input/test.txt
cd ~ cd ~/hadoop rm -r test.txt ls -al
cd ~ cd /usr/local/hadoop ./sbin/start-dfs.sh ./bin/hdfs dfs -get input/test.txt ~/hadoop
./bin/hdfs dfs -rm -r input/test.txt ./bin/hdfs dfs -ls
二、(待做)
标签:ado cal 开头 查看 使用命令 递归 目的 mkdir sbin
原文地址:https://www.cnblogs.com/gzcc211/p/8955310.html