> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/work-with-hadoop-and-hdfs-file-system.md).

# 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>
