123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta content="Apache Forrest" name="Generator">
- <meta name="Forrest-version" content="0.8">
- <meta name="Forrest-skin-name" content="pelt">
- <title>Hadoop Shell Commands</title>
- <link type="text/css" href="skin/basic.css" rel="stylesheet">
- <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
- <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
- <link type="text/css" href="skin/profile.css" rel="stylesheet">
- <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
- <link rel="shortcut icon" href="images/favicon.ico">
- </head>
- <body onload="init()">
- <script type="text/javascript">ndeSetTextSize();</script>
- <div id="top">
- <!--+
- |breadtrail
- +-->
- <div class="breadtrail">
- <a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
- </div>
- <!--+
- |header
- +-->
- <div class="header">
- <!--+
- |start group logo
- +-->
- <div class="grouplogo">
- <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
- </div>
- <!--+
- |end group logo
- +-->
- <!--+
- |start Project Logo
- +-->
- <div class="projectlogo">
- <a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
- </div>
- <!--+
- |end Project Logo
- +-->
- <!--+
- |start Search
- +-->
- <div class="searchbox">
- <form action="http://www.google.com/search" method="get" class="roundtopsmall">
- <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
- <input name="Search" value="Search" type="submit">
- </form>
- </div>
- <!--+
- |end search
- +-->
- <!--+
- |start Tabs
- +-->
- <ul id="tabs">
- <li>
- <a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
- </li>
- <li>
- <a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
- </li>
- <li class="current">
- <a class="selected" href="index.html">Hadoop 0.18 Documentation</a>
- </li>
- </ul>
- <!--+
- |end Tabs
- +-->
- </div>
- </div>
- <div id="main">
- <div id="publishedStrip">
- <!--+
- |start Subtabs
- +-->
- <div id="level2tabs"></div>
- <!--+
- |end Endtabs
- +-->
- <script type="text/javascript"><!--
- document.write("Last Published: " + document.lastModified);
- // --></script>
- </div>
- <!--+
- |breadtrail
- +-->
- <div class="breadtrail">
-
- </div>
- <!--+
- |start Menu, mainarea
- +-->
- <!--+
- |start Menu
- +-->
- <div id="menu">
- <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
- <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
- <div class="menuitem">
- <a href="index.html">Overview</a>
- </div>
- <div class="menuitem">
- <a href="quickstart.html">Quickstart</a>
- </div>
- <div class="menuitem">
- <a href="cluster_setup.html">Cluster Setup</a>
- </div>
- <div class="menuitem">
- <a href="hdfs_design.html">HDFS Architecture</a>
- </div>
- <div class="menuitem">
- <a href="hdfs_user_guide.html">HDFS User Guide</a>
- </div>
- <div class="menuitem">
- <a href="hdfs_permissions_guide.html">HDFS Permissions Guide</a>
- </div>
- <div class="menuitem">
- <a href="hdfs_quota_admin_guide.html">HDFS Quotas Administrator Guide</a>
- </div>
- <div class="menupage">
- <div class="menupagetitle">FS Shell Guide</div>
- </div>
- <div class="menuitem">
- <a href="distcp.html">DistCp Guide</a>
- </div>
- <div class="menuitem">
- <a href="mapred_tutorial.html">Map-Reduce Tutorial</a>
- </div>
- <div class="menuitem">
- <a href="native_libraries.html">Native Hadoop Libraries</a>
- </div>
- <div class="menuitem">
- <a href="streaming.html">Streaming</a>
- </div>
- <div class="menuitem">
- <a href="hadoop_archives.html">Hadoop Archives</a>
- </div>
- <div class="menuitem">
- <a href="hod.html">Hadoop On Demand</a>
- </div>
- <div class="menuitem">
- <a href="api/index.html">API Docs</a>
- </div>
- <div class="menuitem">
- <a href="http://wiki.apache.org/hadoop/">Wiki</a>
- </div>
- <div class="menuitem">
- <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
- </div>
- <div class="menuitem">
- <a href="http://hadoop.apache.org/core/mailing_lists.html">Mailing Lists</a>
- </div>
- <div class="menuitem">
- <a href="releasenotes.html">Release Notes</a>
- </div>
- <div class="menuitem">
- <a href="changes.html">All Changes</a>
- </div>
- </div>
- <div id="credit"></div>
- <div id="roundbottom">
- <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
- <!--+
- |alternative credits
- +-->
- <div id="credit2"></div>
- </div>
- <!--+
- |end Menu
- +-->
- <!--+
- |start content
- +-->
- <div id="content">
- <div title="Portable Document Format" class="pdflink">
- <a class="dida" href="hdfs_shell.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
- PDF</a>
- </div>
- <h1>Hadoop Shell Commands</h1>
- <div id="minitoc-area">
- <ul class="minitoc">
- <li>
- <a href="#FS+Shell"> FS Shell </a>
- <ul class="minitoc">
- <li>
- <a href="#cat"> cat </a>
- </li>
- <li>
- <a href="#chgrp"> chgrp </a>
- </li>
- <li>
- <a href="#chmod"> chmod </a>
- </li>
- <li>
- <a href="#chown"> chown </a>
- </li>
- <li>
- <a href="#copyFromLocal">copyFromLocal</a>
- </li>
- <li>
- <a href="#copyToLocal"> copyToLocal</a>
- </li>
- <li>
- <a href="#cp"> cp </a>
- </li>
- <li>
- <a href="#du">du</a>
- </li>
- <li>
- <a href="#dus"> dus </a>
- </li>
- <li>
- <a href="#expunge"> expunge </a>
- </li>
- <li>
- <a href="#get"> get </a>
- </li>
- <li>
- <a href="#getmerge"> getmerge </a>
- </li>
- <li>
- <a href="#ls"> ls </a>
- </li>
- <li>
- <a href="#lsr">lsr</a>
- </li>
- <li>
- <a href="#mkdir"> mkdir </a>
- </li>
- <li>
- <a href="#movefromLocal"> movefromLocal </a>
- </li>
- <li>
- <a href="#mv"> mv </a>
- </li>
- <li>
- <a href="#put"> put </a>
- </li>
- <li>
- <a href="#rm"> rm </a>
- </li>
- <li>
- <a href="#rmr"> rmr </a>
- </li>
- <li>
- <a href="#setrep"> setrep </a>
- </li>
- <li>
- <a href="#stat"> stat </a>
- </li>
- <li>
- <a href="#tail"> tail </a>
- </li>
- <li>
- <a href="#test"> test </a>
- </li>
- <li>
- <a href="#text"> text </a>
- </li>
- <li>
- <a href="#touchz"> touchz </a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
-
- <a name="N1000D"></a><a name="FS+Shell"></a>
- <h2 class="h3"> FS Shell </h2>
- <div class="section">
- <p>
- The FileSystem (FS) shell is invoked by
- <span class="codefrag">bin/hadoop fs <args></span>.
- All the FS shell commands take path URIs as arguments. The URI
- format is <em>scheme://autority/path</em>. For HDFS the scheme
- is <em>hdfs</em>, and for the local filesystem the scheme
- is <em>file</em>. The scheme and authority are optional. If not
- specified, the default scheme specified in the configuration is
- used. An HDFS file or directory such as <em>/parent/child</em>
- can be specified as <em>hdfs://namenodehost/parent/child</em> or
- simply as <em>/parent/child</em> (given that your configuration
- is set to point to <em>hdfs://namenodehost</em>). Most of the
- commands in FS shell behave like corresponding Unix
- commands. Differences are described with each of the
- commands. Error information is sent to <em>stderr</em> and the
- output is sent to <em>stdout</em>.
- </p>
- <a name="N10034"></a><a name="cat"></a>
- <h3 class="h4"> cat </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -cat URI [URI …]</span>
-
- </p>
- <p>
- Copies source paths to <em>stdout</em>.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -cat hdfs://nn1.example.com/file1 hdfs://nn2.example.com/file2
- </span>
-
- </li>
-
- <li>
-
- <span class="codefrag">hadoop fs -cat file:///file3 /user/hadoop/file4 </span>
-
- </li>
-
- </ul>
- <p>Exit Code:<br>
-
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
- </p>
- <a name="N10060"></a><a name="chgrp"></a>
- <h3 class="h4"> chgrp </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -chgrp [-R] GROUP URI [URI …]</span>
-
- </p>
- <p>
- Change group association of files. With <span class="codefrag">-R</span>, make the change recursively through the directory structure. The user must be the owner of files, or else a super-user. Additional information is in the <a href="hdfs_permissions_guide.html">Permissions User Guide</a>.
- </p>
- <a name="N10077"></a><a name="chmod"></a>
- <h3 class="h4"> chmod </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI [URI …]</span>
-
- </p>
- <p>
- Change the permissions of files. With <span class="codefrag">-R</span>, make the change recursively through the directory structure. The user must be the owner of the file, or else a super-user. Additional information is in the <a href="hdfs_permissions_guide.html">Permissions User Guide</a>.
- </p>
- <a name="N1008E"></a><a name="chown"></a>
- <h3 class="h4"> chown </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -chown [-R] [OWNER][:[GROUP]] URI [URI ]</span>
-
- </p>
- <p>
- Change the owner of files. With <span class="codefrag">-R</span>, make the change recursively through the directory structure. The user must be a super-user. Additional information is in the <a href="hdfs_permissions_guide.html">Permissions User Guide</a>.
- </p>
- <a name="N100A5"></a><a name="copyFromLocal"></a>
- <h3 class="h4">copyFromLocal</h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -copyFromLocal <localsrc> URI</span>
-
- </p>
- <p>Similar to <a href="#putlink"><strong>put</strong></a> command, except that the source is restricted to a local file reference. </p>
- <a name="N100BA"></a><a name="copyToLocal"></a>
- <h3 class="h4"> copyToLocal</h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -copyToLocal [-ignorecrc] [-crc] URI <localdst></span>
-
- </p>
- <p> Similar to <a href="#getlink"><strong>get</strong></a> command, except that the destination is restricted to a local file reference.</p>
- <a name="N100CF"></a><a name="cp"></a>
- <h3 class="h4"> cp </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -cp URI [URI …] <dest></span>
-
- </p>
- <p>
- Copy files from source to destination. This command allows multiple sources as well in which case the destination must be a directory.
- <br>
- Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2</span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir </span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
-
- </p>
- <a name="N100F9"></a><a name="du"></a>
- <h3 class="h4">du</h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -du URI [URI …]</span>
-
- </p>
- <p>
- Displays aggregate length of files contained in the directory or the length of a file in case its just a file.<br>
- Example:<br>
- <span class="codefrag">hadoop fs -du /user/hadoop/dir1 /user/hadoop/file1 hdfs://nn.example.com/user/hadoop/dir1</span>
- <br>
- Exit Code:<br>
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
- <br>
- </p>
- <a name="N10114"></a><a name="dus"></a>
- <h3 class="h4"> dus </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -dus <args></span>
-
- </p>
- <p>
- Displays a summary of file lengths.
- </p>
- <a name="N10124"></a><a name="expunge"></a>
- <h3 class="h4"> expunge </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -expunge</span>
-
- </p>
- <p>Empty the Trash. Refer to <a href="hdfs_design.html">HDFS Design</a> for more information on Trash feature.
- </p>
- <a name="N10138"></a><a name="get"></a>
- <h3 class="h4"> get </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -get [-ignorecrc] [-crc] <src> <localdst></span>
-
- <br>
-
- </p>
- <p>
- Copy files to the local file system. Files that fail the CRC check may be copied with the
- <span class="codefrag">-ignorecrc</span> option. Files and CRCs may be copied using the
- <span class="codefrag">-crc</span> option.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -get /user/hadoop/file localfile </span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -get hdfs://nn.example.com/user/hadoop/file localfile</span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
-
- </p>
- <a name="N1016C"></a><a name="getmerge"></a>
- <h3 class="h4"> getmerge </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -getmerge <src> <localdst> [addnl]</span>
-
- </p>
- <p>
- Takes a source directory and a destination file as input and concatenates files in src into the destination local file. Optionally <span class="codefrag">addnl</span> can be set to enable adding a newline character at the end of each file.
- </p>
- <a name="N1017F"></a><a name="ls"></a>
- <h3 class="h4"> ls </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -ls <args></span>
-
- </p>
- <p>
- For a file returns stat on the file with the following format:<br>
- <span class="codefrag">filename <number of replicas> filesize modification_date modification_time permissions userid groupid</span>
- <br>
- For a directory it returns list of its direct children as in unix.
- A directory is listed as: <br>
- <span class="codefrag">dirname <dir> modification_time modification_time permissions userid groupid</span>
- <br>
- Example:<br>
- <span class="codefrag">hadoop fs -ls /user/hadoop/file1 /user/hadoop/file2 hdfs://nn.example.com/user/hadoop/dir1 /nonexistentfile</span>
- <br>
- Exit Code:<br>
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
- <br>
- </p>
- <a name="N101A2"></a><a name="lsr"></a>
- <h3 class="h4">lsr</h3>
- <p>
- <span class="codefrag">Usage: hadoop fs -lsr <args></span>
- <br>
- Recursive version of <span class="codefrag">ls</span>. Similar to Unix <span class="codefrag">ls -R</span>.
- </p>
- <a name="N101B5"></a><a name="mkdir"></a>
- <h3 class="h4"> mkdir </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -mkdir <paths></span>
-
- <br>
-
- </p>
- <p>
- Takes path uri's as argument and creates directories. The behavior is much like unix mkdir -p creating parent directories along the path.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag">hadoop fs -mkdir /user/hadoop/dir1 /user/hadoop/dir2 </span>
-
- </li>
-
- <li>
-
- <span class="codefrag">hadoop fs -mkdir hdfs://nn1.example.com/user/hadoop/dir hdfs://nn2.example.com/user/hadoop/dir
- </span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag">Returns 0 on success and -1 on error.</span>
-
- </p>
- <a name="N101E2"></a><a name="movefromLocal"></a>
- <h3 class="h4"> movefromLocal </h3>
- <p>
-
- <span class="codefrag">Usage: dfs -moveFromLocal <src> <dst></span>
-
- </p>
- <p>Displays a "not implemented" message.
- </p>
- <a name="N101F2"></a><a name="mv"></a>
- <h3 class="h4"> mv </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -mv URI [URI …] <dest></span>
-
- </p>
- <p>
- Moves files from source to destination. This command allows multiple sources as well in which case the destination needs to be a directory. Moving files across filesystems is not permitted.
- <br>
- Example:
- </p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -mv /user/hadoop/file1 /user/hadoop/file2</span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -mv hdfs://nn.example.com/file1 hdfs://nn.example.com/file2 hdfs://nn.example.com/file3 hdfs://nn.example.com/dir1</span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
-
- </p>
- <a name="N1021C"></a><a name="put"></a>
- <h3 class="h4"> put </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -put <localsrc> ... <dst></span>
-
- </p>
- <p>Copy single src, or multiple srcs from local file system to the destination filesystem. Also reads input from stdin and writes to destination filesystem.<br>
-
- </p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -put localfile /user/hadoop/hadoopfile</span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -put localfile1 localfile2 /user/hadoop/hadoopdir</span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -put localfile hdfs://nn.example.com/hadoop/hadoopfile</span>
-
- </li>
-
- <li>
- <span class="codefrag">hadoop fs -put - hdfs://nn.example.com/hadoop/hadoopfile</span>
- <br>Reads the input from stdin.</li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
-
- </p>
- <a name="N10253"></a><a name="rm"></a>
- <h3 class="h4"> rm </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -rm URI [URI …] </span>
-
- </p>
- <p>
- Delete files specified as args. Only deletes non empty directory and files. Refer to rmr for recursive deletes.<br>
- Example:
- </p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -rm hdfs://nn.example.com/file /user/hadoop/emptydir </span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
-
- </p>
- <a name="N10277"></a><a name="rmr"></a>
- <h3 class="h4"> rmr </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -rmr URI [URI …]</span>
-
- </p>
- <p>Recursive version of delete.<br>
- Example:
- </p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -rmr /user/hadoop/dir </span>
-
- </li>
-
- <li>
-
- <span class="codefrag"> hadoop fs -rmr hdfs://nn.example.com/user/hadoop/dir </span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag"> Returns 0 on success and -1 on error. </span>
-
- </p>
- <a name="N102A1"></a><a name="setrep"></a>
- <h3 class="h4"> setrep </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -setrep [-R] <path></span>
-
- </p>
- <p>
- Changes the replication factor of a file. -R option is for recursively increasing the replication factor of files within a directory.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -setrep -w 3 -R /user/hadoop/dir1 </span>
-
- </li>
-
- </ul>
- <p>Exit Code:</p>
- <p>
-
- <span class="codefrag">Returns 0 on success and -1 on error. </span>
-
- </p>
- <a name="N102C6"></a><a name="stat"></a>
- <h3 class="h4"> stat </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -stat URI [URI …]</span>
-
- </p>
- <p>
- Returns the stat information on the path.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -stat path </span>
-
- </li>
-
- </ul>
- <p>Exit Code:<br>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
- </p>
- <a name="N102E9"></a><a name="tail"></a>
- <h3 class="h4"> tail </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -tail [-f] URI </span>
-
- </p>
- <p>
- Displays last kilobyte of the file to stdout. -f option can be used as in Unix.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -tail pathname </span>
-
- </li>
-
- </ul>
- <p>Exit Code: <br>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
- </p>
- <a name="N1030C"></a><a name="test"></a>
- <h3 class="h4"> test </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -test -[ezd] URI</span>
-
- </p>
- <p>
- Options: <br>
- -e check to see if the file exists. Return 0 if true. <br>
- -z check to see if the file is zero length. Return 0 if true <br>
- -d check return 1 if the path is directory else return 0. <br>
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop fs -test -e filename </span>
-
- </li>
-
- </ul>
- <a name="N1032F"></a><a name="text"></a>
- <h3 class="h4"> text </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -text <src></span>
-
- <br>
-
- </p>
- <p>
- Takes a source file and outputs the file in text format. The allowed formats are zip and TextRecordInputStream.
- </p>
- <a name="N10341"></a><a name="touchz"></a>
- <h3 class="h4"> touchz </h3>
- <p>
-
- <span class="codefrag">Usage: hadoop fs -touchz URI [URI …]</span>
-
- <br>
-
- </p>
- <p>
- Create a file of zero length.
- </p>
- <p>Example:</p>
- <ul>
-
- <li>
-
- <span class="codefrag"> hadoop -touchz pathname </span>
-
- </li>
-
- </ul>
- <p>Exit Code:<br>
-
- <span class="codefrag"> Returns 0 on success and -1 on error.</span>
- </p>
- </div>
-
- </div>
- <!--+
- |end content
- +-->
- <div class="clearboth"> </div>
- </div>
- <div id="footer">
- <!--+
- |start bottomstrip
- +-->
- <div class="lastmodified">
- <script type="text/javascript"><!--
- document.write("Last Published: " + document.lastModified);
- // --></script>
- </div>
- <div class="copyright">
- Copyright ©
- 2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
- </div>
- <!--+
- |end bottomstrip
- +-->
- </div>
- </body>
- </html>
|