Work with Hadoop and HDFS file system

Work with Hadoop and HDFS file system

cd $HADOOP_HOME

Create a directory on the hdfs file system (not your local OS file system)

hdfs dfs -mkdir /mydir

There is LICENSE.txt in $HADOOP_HOME directory, copy it into hdfs file system /mydir

hdfs dfs -put LICENSE.txt /mydir

You can check the existence of the LICENSE.txt in hdfs file system directory /mydir

hdfs dfs -ls /mydir

After done playing, clean it up:

hdfs dfs -rm /mydir/*

hdfs dfs -rmdir /mydir

You can show the full list of hdfs command by

hdfs dfs -help

Hadoop hdfs command guide:

https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html

Last updated