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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://george-jen.gitbook.io/data-science-and-apache-spark/work-with-hadoop-and-hdfs-file-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
