HDFS Command Reference

The commands demonstrated in this section are the basic file operations needed to begin using HDFS. Below is a full listing of file manipulation commands possible with hdfs dfs. This listing can also be displayed from the command line by specifying hdfs dfs without any arguments. To get help with a specific option, use either hdfs dfs -usage <option> or hdfs dfs -help <option>.

Usage: hadoop fs [generic options]
[-appendToFile &lt;localsrc&gt; ... &lt;dst&gt;]
[-cat [-ignoreCrc] &lt;src&gt; ...]
[-checksum &lt;src&gt; ...]
[-chgrp [-R] GROUP PATH...]
[-chmod [-R] &lt;MODE[,MODE]... | OCTALMODE&gt; PATH...]
[-chown [-R] [OWNER][:[GROUP]] PATH...]
[-copyFromLocal [-f] [-p] [-l] &lt;localsrc&gt; ... &lt;dst&gt;]
[-copyToLocal [-p] [-ignoreCrc] [-crc] &lt;src&gt; ...
&lt;localdst&gt;]
[-count [-q] [-h] &lt;path&gt; ...]
[-cp [-f] [-p | -p[topax]] &lt;src&gt; ... &lt;dst&gt;]
[-createSnapshot &lt;snapshotDir&gt; [&lt;snapshotName&gt;]]
[-deleteSnapshot &lt;snapshotDir&gt; &lt;snapshotName&gt;]
[-df [-h] [&lt;path&gt; ...]]
[-du [-s] [-h] &lt;path&gt; ...]
[-expunge]
[-find &lt;path&gt; ... &lt;expression&gt; ...]
[-get [-p] [-ignoreCrc] [-crc] &lt;src&gt; ... &lt;localdst&gt;]
[-getfacl [-R] &lt;path&gt;]
[-getfattr [-R] {-n name | -d} [-e en] &lt;path&gt;]
[-getmerge [-nl] &lt;src&gt; &lt;localdst&gt;]
[-help [cmd ...]]
[-ls [-d] [-h] [-R] [&lt;path&gt; ...]]
[-mkdir [-p] &lt;path&gt; ...]
[-moveFromLocal &lt;localsrc&gt; ... &lt;dst&gt;]
[-moveToLocal &lt;src&gt; &lt;localdst&gt;]
[-mv &lt;src&gt; ... &lt;dst&gt;]
[-put [-f] [-p] [-l] &lt;localsrc&gt; ... &lt;dst&gt;]
[-renameSnapshot &lt;snapshotDir&gt; &lt;oldName&gt; &lt;newName&gt;]
[-rm [-f] [-r|-R] [-skipTrash] &lt;src&gt; ...]
[-rmdir [--ignore-fail-on-non-empty] &lt;dir&gt; ...]
[-setfacl [-R] [{-b|-k} {-m|-x &lt;acl_spec&gt;} &lt;path&gt;]|[--set
&lt;acl_spec&gt; &lt;path&gt;]]
[-setfattr {-n name [-v value] | -x name} &lt;path&gt;]
[-setrep [-R] [-w] &lt;rep&gt; &lt;path&gt; ...]
[-stat [format] &lt;path&gt; ...]
[-tail [-f] &lt;file&gt;]
[-test -[defsz] &lt;path&gt;]
[-text [-ignoreCrc] &lt;src&gt; ...]
[-touchz &lt;path&gt; ...]
[-truncate [-w] &lt;length&gt; &lt;path&gt; ...]
[-usage [cmd ...]]
Generic options supported are
-conf &lt;configuration file&gt; specify an application configuration
file
-D &lt;property=value&gt; use value for given property
-fs &lt;local|namenode:port&gt; specify a namenode
-jt &lt;local|resourcemanager:port&gt; specify a ResourceManager
-files &lt;comma separated list of files&gt; specify comma separa-
6 | Chapter 1: Hadoop Distributed File System (HDFS)
ted files to be copied to the map reduce cluster
-libjars &lt;comma separated list of jars&gt; specify comma separated
jar files to include in the classpath.
-archives &lt;comma separated list of archives&gt; specify comma
separated archives to be unarchived on the compute machines.
The general command line syntax is
bin/hadoop command [genericOptions] [commandOptions]

The next section introduces a Python library that allows HDFS to be accessed from within Python applications.

READ  CryptoLicensing For .Net v2015 Adds Machine Code, Short Serial Codes, Support for Windows Store and License Export

Leave a Reply

Your email address will not be published.