“mkdir”
command is used to create directories.
Usage:
hadoop fs
[generic options] -mkdir [-p] <path> ...
-p option
create parent directories along the path.
Example
hadoop fs -mkdir -p /user/cloudera/demo2
Above command create a direcotry 'demo2' in the folder /user/cloudera. -p option is used to create parent directories if not exist.
[cloudera@quickstart ~]$ hadoop fs -ls /user/cloudera
Found 1 items
drwxr-xr-x - cloudera cloudera 0 2022-03-22 09:27 /user/cloudera/demo1
[cloudera@quickstart ~]$
[cloudera@quickstart ~]$ hadoop fs -mkdir -p /user/cloudera/demo2
[cloudera@quickstart ~]$
[cloudera@quickstart ~]$ hadoop fs -ls /user/cloudera
Found 2 items
drwxr-xr-x - cloudera cloudera 0 2022-03-22 09:27 /user/cloudera/demo1
drwxr-xr-x - cloudera cloudera 0 2022-03-22 23:48 /user/cloudera/demo2
[cloudera@quickstart ~]$
No comments:
Post a Comment