blob: 99c2b4096ccf1c9872ca33c9d6f4e00a3479bd72 [file] [log] [blame]
<!--
Documentation/_templates/layout.html
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. The
ASF licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Commands &mdash; NuttX latest documentation</title>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/segment.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/menu.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sphinx_tabs/tabs.css" type="text/css" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/language_data.js"></script>
<script type="text/javascript" src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Configuration Settings" href="config.html" />
<link rel="prev" title="Overview" href="nsh.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../index.html" class="icon icon-home"> NuttX
<img src="../../_static/NuttX.png" class="logo" alt="Logo"/>
</a>
<!-- this version selector is quite ugly, should be probably replaced by something
more modern -->
<div class="version-selector">
<select>
<option value="latest" selected="selected">latest</option>
</select>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../introduction/index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Getting Started</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">OS Components</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="index.html">NuttShell (NSH)</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="nsh.html">Overview</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Commands</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#evaluate-expression-test">Evaluate Expression (test)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#add-a-routing-table-entry-addroute">Add a Routing Table Entry (addroute)</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="config.html">Configuration Settings</a></li>
<li class="toctree-l3"><a class="reference internal" href="customizing.html">Customizing the NuttShell</a></li>
<li class="toctree-l3"><a class="reference internal" href="builtin.html">NSH “Built-In” Applications</a></li>
<li class="toctree-l3"><a class="reference internal" href="installation.html">Customizing NSH Initialization</a></li>
<li class="toctree-l3"><a class="reference internal" href="login.html">Shell Login</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../power.html">Power Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../socketcan.html">SocketCAN Device Drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../syslog.html">SYSLOG</a></li>
<li class="toctree-l2"><a class="reference internal" href="../binfmt.html">Binary Loader</a></li>
<li class="toctree-l2"><a class="reference internal" href="../drivers/index.html">Device Drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../filesystem.html">NuttX File System</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nxflat.html">NXFLAT</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nxgraphics/index.html">NX Graphics Subsystem</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nxwidgets.html">NxWidgets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../paging.html">On-Demand Paging</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../applications/index.html">Applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../boards/index.html">Supported Boards</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../reference/index.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../guides/index.html">Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/index.html">Releases</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contributing/index.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">NuttX</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../index.html">OS Components</a> &raquo;</li>
<li><a href="index.html">NuttShell (NSH)</a> &raquo;</li>
<li>Commands</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/components/nsh/commands.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="commands">
<h1>Commands<a class="headerlink" href="#commands" title="Permalink to this headline"></a></h1>
<div class="section" id="evaluate-expression-test">
<h2>Evaluate Expression (test)<a class="headerlink" href="#evaluate-expression-test" title="Permalink to this headline"></a></h2>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-fish notranslate"><div class="highlight"><pre><span></span><span class="o">[</span> <span class="o">&lt;</span>expression&gt; <span class="o">]</span>
<span class="k">test</span> <span class="o">&lt;</span>expression&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. These are two alternative forms of the same command.
They support evaluation of a boolean expression which sets
<code class="docutils literal notranslate"><span class="pre">$?</span></code>. This command is used most frequently as
the conditional command following the <code class="docutils literal notranslate"><span class="pre">if</span></code> in the
<code class="docutils literal notranslate"><span class="pre">if-then[-else]-fi</span></code>.</p>
<p><strong>Expression Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>expression = simple-expression | !expression | expression -o expression | expression -a expression
simple-expression = unary-expression | binary-expression
unary-expression = string-unary | file-unary
string-unary = -n string | -z string
file-unary = -b file | -c file | -d file | -e file | -f file | -r file | -s file | -w file
binary-expression = string-binary | numeric-binary
string-binary = string = string | string == string | string != string
numeric-binary = integer -eq integer | integer -ge integer | integer -gt integer | integer -le integer | integer -lt integer | integer -ne integer
</pre></div>
</div>
</div>
<div class="section" id="add-a-routing-table-entry-addroute">
<h2>Add a Routing Table Entry (addroute)<a class="headerlink" href="#add-a-routing-table-entry-addroute" title="Permalink to this headline"></a></h2>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>addroute &lt;target&gt; [&lt;netmask&gt;] &lt;router&gt;
addroute default &lt;ipaddr&gt; &lt;interface&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. This command adds an entry in the routing table. The
new entry will map the IP address of a router on a local network
(&lt;router&gt;) to an external network characterized by the &lt;target&gt; IP
address and a network mask &lt;netmask&gt;</p>
<p>The netmask may also be expressed using IPv4 CIDR or IPv6 slash
notation. In that case, the netmask need not be provided.</p>
<p><strong>Example:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; addroute addroute 11.0.0.0 255.255.255.0 10.0.0.2
</pre></div>
</div>
<p>which is equivalent to</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; addroute 11.0.0.0/24 10.0.0.2
</pre></div>
</div>
<p>The second form of the addroute command can be used to set the
default gateway.</p>
<div class="section" id="access-the-arp-table-arp">
<h3>Access the ARP table (arp)<a class="headerlink" href="#access-the-arp-table-arp" title="Permalink to this headline"></a></h3>
<p><strong>Command syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>arp [-t|-a &lt;ipaddr&gt; |-d &lt;ipaddr&gt; |-s &lt;ipaddr&gt; &lt;hwaddr&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>: Access the OS ARP table.</p>
<blockquote>
<div><dl class="option-list">
<dt><kbd><span class="option">-a <var>&lt;ipaddr&gt;</var></span></kbd></dt>
<dd><p>Will show the hardware address that the IP address &lt;ipaddr&gt; is
mapped to.</p>
</dd>
<dt><kbd><span class="option">-d <var>&lt;ipaddr&gt;</var></span></kbd></dt>
<dd><p>Will delete the mapping for the IP address &lt;ipaddr&gt; from the
ARP table.</p>
</dd>
<dt><kbd><span class="option">-s <var>&lt;ipaddr hwaddr&gt;</var></span></kbd></dt>
<dd><p>Will set (or replace) the mapping of the IP address &lt;ipaddr&gt; to
the hardware address &lt;hwaddr&gt;.</p>
</dd>
<dt><kbd><span class="option">-t</span></kbd></dt>
<dd><p>Will dump the entire content of the ARP table. This option is
only available if <code class="docutils literal notranslate"><span class="pre">CONFIG_NETLINK_ROUTE</span></code> is enabled.</p>
</dd>
</dl>
</div></blockquote>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; arp -a 10.0.0.1
nsh: arp: no such ARP entry: 10.0.0.1
nsh&gt; arp -s 10.0.0.1 00:13:3b:12:73:e6
nsh&gt; arp -a 10.0.0.1
HWAddr: 00:13:3b:12:73:e6
nsh&gt; arp -d 10.0.0.1
nsh&gt; arp -a 10.0.0.1
nsh: arp: no such ARP entry: 10.0.0.1
</pre></div>
</div>
</div>
<div class="section" id="base64-decode-base64dec">
<h3>Base64 Decode (base64dec)<a class="headerlink" href="#base64-decode-base64dec" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>base64dec [-w] [-f] &lt;string or filepath&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. <em>To be provided.</em></p>
</div>
<div class="section" id="base64-encode-base64enc">
<h3>Base64 Encode (base64enc)<a class="headerlink" href="#base64-encode-base64enc" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>base64enc [-w] [-f] &lt;string or filepath&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. <em>To be provided.</em></p>
</div>
<div class="section" id="extract-base-file-directory-name-basename">
<h3>Extract Base File/Directory Name (basename)<a class="headerlink" href="#extract-base-file-directory-name-basename" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>basename &lt;path&gt; [&lt;suffix&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Extract the final string from a <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code> by
removing the preceding path segments and (optionally) removing any
trailing <code class="docutils literal notranslate"><span class="pre">&lt;suffix&gt;</span></code>.</p>
</div>
<div class="section" id="terminate-a-loop-break">
<h3>Terminate a Loop (break)<a class="headerlink" href="#terminate-a-loop-break" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>break
</pre></div>
</div>
<p><strong>Synopsis</strong>. The <code class="docutils literal notranslate"><span class="pre">break</span></code> command is only meaningful within the
body of the a <a class="reference external" href="#looping">while</a> or <a class="reference external" href="#looping">until</a> loop,
between the <code class="docutils literal notranslate"><span class="pre">do</span></code> and <code class="docutils literal notranslate"><span class="pre">done</span></code> tokens. Outside of a loop,
<code class="docutils literal notranslate"><span class="pre">break</span></code> command does nothing. If the <code class="docutils literal notranslate"><span class="pre">break</span></code> command is
executed within the body of a loop, the loop will immediately
terminate and execution will continue with the next command
immediately following the <code class="docutils literal notranslate"><span class="pre">done</span></code> token.</p>
</div>
<div class="section" id="concatenate-files-cat">
<h3>Concatenate Files (cat)<a class="headerlink" href="#concatenate-files-cat" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cat &lt;path&gt; [&lt;path&gt; [&lt;path&gt; ...]]
</pre></div>
</div>
<p><strong>Synopsis</strong>. This command copies and concatenates all of the
files at <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code> to the console (or to another file if the
output is redirected).</p>
</div>
<div class="section" id="change-current-working-directory-cd">
<h3>Change Current Working Directory (cd)<a class="headerlink" href="#change-current-working-directory-cd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd [&lt;dir-path&gt;|-|~|..]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Changes the current working directory (<code class="docutils literal notranslate"><span class="pre">PWD</span></code>).
Also sets the previous working directory environment variable
(<code class="docutils literal notranslate"><span class="pre">OLDPWD</span></code>).</p>
<p><strong>Forms:</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 21%" />
<col style="width: 79%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">cd</span> <span class="pre">&lt;dir-path&gt;</span></code></p></td>
<td><p>sets the current working directory to &lt;dir-path&gt;.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">cd</span> <span class="pre">-</span></code></p></td>
<td><p>sets the current working directory to the previous
working directory ($OLDPWD). Equivalent to cd $OLDPWD.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">cd</span></code> or <code class="docutils literal notranslate"><span class="pre">cd</span> <span class="pre">~</span></code></p></td>
<td><p>set the current working directory to the ‘home’ directory.
The home directory can be configured by setting CONFIG_LIB_HOMEDIR
in the configuration file. The default home directory is /.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">cd</span> <span class="pre">..</span></code></p></td>
<td><p>sets the current working directory to the parent directory.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="compare-files-cmp">
<h3>Compare Files (cmp)<a class="headerlink" href="#compare-files-cmp" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cmp &lt;path1&gt; &lt;path2&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Compare of the contents of the file at <code class="docutils literal notranslate"><span class="pre">&lt;path1&gt;</span></code>
with the contents of the file at <code class="docutils literal notranslate"><span class="pre">&lt;path2&gt;</span></code>. Returns an
indication only if the files differ.</p>
</div>
<div class="section" id="copy-files-cp">
<h3>Copy Files (cp)<a class="headerlink" href="#copy-files-cp" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cp &lt;source-path&gt; &lt;dest-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Copy of the contents of the file at
<code class="docutils literal notranslate"><span class="pre">&lt;source-path&gt;</span></code> to the location in the file system indicated by
<code class="docutils literal notranslate"><span class="pre">&lt;dest-path&gt;</span></code>.</p>
</div>
<div class="section" id="show-or-set-the-date-and-time-date">
<h3>Show or set the date and time (date)<a class="headerlink" href="#show-or-set-the-date-and-time-date" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>date [-s &quot;MMM DD HH:MM:SS YYYY&quot;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show or set the current date and time.</p>
<p>Only one format is used both on display and when setting the
date/time: <code class="docutils literal notranslate"><span class="pre">MMM</span> <span class="pre">DD</span> <span class="pre">HH:MM:SS</span> <span class="pre">YYYY</span></code>. For example,</p>
<p>24-hour time is used.</p>
</div>
<div class="section" id="copy-and-convert-files-dd">
<h3>Copy and Convert Files (dd)<a class="headerlink" href="#copy-and-convert-files-dd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dd if=&lt;infile&gt; of=&lt;outfile&gt; [bs=&lt;sectsize&gt;] [count=&lt;sectors&gt;] [skip=&lt;sectors&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Copy blocks from &lt;infile&gt; to &lt;outfile&gt;. &lt;infile&gt; or
&lt;outfile&gt; may be the path to a standard file, a character device,
or a block device. Examples follow:</p>
<p>Read from character device, write to regular file. This will
create a new file of the specified size filled with zero:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 zero
nsh&gt; dd if=/dev/zero of=/tmp/zeros bs=64 count=16
nsh&gt; ls -l /tmp
/tmp:
-rw-rw-rw- 1024 ZEROS
</pre></div>
</div>
<p>Read from character device, write to block device. This will fill
the entire block device with zeros:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /dev
/dev:
brw-rw-rw- 0 ram0
crw-rw-rw- 0 zero
nsh&gt; dd if=/dev/zero of=/dev/ram0
</pre></div>
</div>
<p>Read from a block device, write to a character device. This will
read the entire block device and dump the contents in the bit
bucket:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
nsh&gt; dd if=/dev/ram0 of=/dev/null
</pre></div>
</div>
</div>
<div class="section" id="delete-a-routing-table-entry-delroute">
<h3>Delete a Routing Table Entry (delroute)<a class="headerlink" href="#delete-a-routing-table-entry-delroute" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>delroute &lt;target&gt; [&lt;netmask&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. The entry removed will be the first entry in the
routing table that matches the external network characterized by
the &lt;target&gt; IP address and the network mask &lt;netmask&gt;</p>
<p>The netmask may also be expressed using IPv4 CIDR or IPv6 slash
notation. In that case, the netmask need not be provided.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; delroute 11.0.0.0 255.255.255.0
</pre></div>
</div>
<p>which is equivalent to:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; delroute 11.0.0.0/24
</pre></div>
</div>
</div>
<div class="section" id="show-volume-status-df">
<h3>Show Volume Status (df)<a class="headerlink" href="#show-volume-status-df" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>df [-h]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the state of each mounted volume. As an
example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mount
/etc type romfs
/tmp type vfat
nsh&gt; df
Block Number
Size Blocks Used Available Mounted on
64 6 6 0 /etc
512 985 2 983 /tmp
nsh&gt;
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_CMDOPT_DF_H</span></code> is defined in the NuttX
configuration, then the <code class="docutils literal notranslate"><span class="pre">df</span></code> will also support an option <code class="docutils literal notranslate"><span class="pre">-h</span></code>
which may be used to show the volume information in <em>human
readable</em> format.</p>
</div>
<div class="section" id="extract-path-to-a-file-directory-dirname">
<h3>Extract Path to a File/Directory (dirname)<a class="headerlink" href="#extract-path-to-a-file-directory-dirname" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dirname &lt;path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Extract the path string leading up to the full
<code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code> by removing the final directory or file name.</p>
</div>
<div class="section" id="dump-buffered-syslog-output-dmesg">
<h3>Dump Buffered SYSLOG Output (dmesg)<a class="headerlink" href="#dump-buffered-syslog-output-dmesg" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dmesg
</pre></div>
</div>
<p><strong>Synopsis</strong>. This command can be used to dump (and clear) the
content of any buffered syslog output messages. This command is
only available if <code class="docutils literal notranslate"><span class="pre">CONFIG_RAMLOG_SYSLOG</span></code> is enabled. In that
case, syslog output will be collected in an in-memory, circular
buffer. Entering the <code class="docutils literal notranslate"><span class="pre">dmesg</span></code> command will dump the content of
that in-memory, circular buffer to the NSH console output.
<code class="docutils literal notranslate"><span class="pre">dmesg</span></code> has the side effect of clearing the buffered data so
that entering <code class="docutils literal notranslate"><span class="pre">dmesg</span></code> again will show only newly buffered data.</p>
</div>
<div class="section" id="echo-strings-and-variables-echo">
<h3>Echo Strings and Variables (echo)<a class="headerlink" href="#echo-strings-and-variables-echo" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo [-n] [&lt;string|$name&gt; [&lt;string|$name&gt;...]]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Copy the sequence of strings and expanded
environment variables to console output (or to a file if the
output is re-directed).</p>
<p>The <code class="docutils literal notranslate"><span class="pre">-n</span></code> option suppresses the trailing newline character.</p>
</div>
<div class="section" id="show-environment-variables-env">
<h3>Show Environment Variables (env)<a class="headerlink" href="#show-environment-variables-env" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>env
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the current name-value pairs in the
environment. Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; env
PATH=/bin
nsh&gt; set foo bar
nsh&gt; env
PATH=/bin
foo=bar
nsh&gt; unset PATH
nsh&gt; env
foo=bar
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="execute-user-code-exec">
<h3>Execute User Code (exec)<a class="headerlink" href="#execute-user-code-exec" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>exec &lt;hex-address&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Execute the user logic at address <code class="docutils literal notranslate"><span class="pre">&lt;hex-address&gt;</span></code>.
NSH will pause until the execution unless the user logic is
executed in background via <code class="docutils literal notranslate"><span class="pre">exec</span> <span class="pre">&lt;hex-address&gt;</span> <span class="pre">&amp;</span></code>.</p>
</div>
<div class="section" id="exit-nsh-exit">
<h3>Exit NSH (exit)<a class="headerlink" href="#exit-nsh-exit" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>exit
</pre></div>
</div>
<p><strong>Synopsis</strong>. Exit NSH. Only useful for the serial front end if
you have started some other tasks (perhaps using the <code class="docutils literal notranslate"><span class="pre">exec</span></code>
command) and you would like to have NSH out of the way. For the
telnet front-end, <code class="docutils literal notranslate"><span class="pre">exit</span></code> terminates the telnet session.</p>
</div>
<div class="section" id="set-an-environment-variable-export">
<h3>Set an Environment Variable (export)<a class="headerlink" href="#set-an-environment-variable-export" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>export &lt;name&gt; [&lt;value&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. The <code class="docutils literal notranslate"><span class="pre">export</span></code> command sets an environment variable,
or promotes an NSH variable to an environment variable. As
examples:</p>
<blockquote>
<div><ol class="arabic">
<li><p>Using <code class="docutils literal notranslate"><span class="pre">export</span></code> to promote an NSH variable to an environment
variable:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; env
PATH=/bin
nsh&gt; set foo bar
nsh&gt; env
PATH=/bin
nsh&gt; export foo
nsh&gt; env
PATH=/bin
foo=bar
</pre></div>
</div>
<p>A group-wide environment variable is created with the same
value as the local NSH variable; the local NSH variable is
removed.</p>
<blockquote>
<div></div></blockquote>
</li>
<li><p>Using <code class="docutils literal notranslate"><span class="pre">export</span></code> to set an environment variable:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; export dog poop
nsh&gt; env
PATH=/bin
foo=bar
dog=poop
</pre></div>
</div>
</li>
</ol>
</div></blockquote>
<p>The <code class="docutils literal notranslate"><span class="pre">export</span></code> command is not supported by NSH unless both
<code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_VARS=y</span></code> and <code class="docutils literal notranslate"><span class="pre">CONFIG_DISABLE_ENVIRON</span></code>is not set.</p>
</div>
<div class="section" id="show-memory-manager-status-free">
<h3>Show Memory Manager Status (free)<a class="headerlink" href="#show-memory-manager-status-free" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>free
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the current state of the memory allocator. For
example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; free
total used free largest
Mem: 4194288 1591552 2602736 2601584
nsh&gt;
</pre></div>
</div>
<p><strong>Where:</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 9%" />
<col style="width: 91%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>total</p></td>
<td><p>This is the total size of memory allocated for use by malloc in bytes.</p></td>
</tr>
<tr class="row-even"><td><p>used</p></td>
<td><p>This is the total size of memory occupied by chunks handed out by malloc.</p></td>
</tr>
<tr class="row-odd"><td><p>free</p></td>
<td><p>This is the total size of memory occupied by free (not in use) chunks.</p></td>
</tr>
<tr class="row-even"><td><p>largest</p></td>
<td><p>Size of the largest free (not in use) chunk.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="get-file-via-tftp-get">
<h3>Get File Via TFTP (get)<a class="headerlink" href="#get-file-via-tftp-get" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>get [-b|-n] [-f &lt;local-path&gt;] -h &lt;ip-address&gt; &lt;remote-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Copy the file at <code class="docutils literal notranslate"><span class="pre">&lt;remote-address&gt;</span></code> from the host
whose IP address is identified by <code class="docutils literal notranslate"><span class="pre">&lt;ip-address&gt;</span></code>.</p>
<p><strong>Other options</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 16%" />
<col style="width: 84%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre">&lt;local-path&gt;</span></code></p></td>
<td><p>The file will be saved relative to the current working directory unless &lt;local-path&gt; is provided.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-n</span></code></p></td>
<td><p>Selects text (“netascii”) transfer mode (default).</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-b</span></code></p></td>
<td><p>Selects binary (“octet”) transfer mode</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="show-usage-command-usage-help">
<h3>Show Usage Command Usage (help)<a class="headerlink" href="#show-usage-command-usage-help" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>help [-v] [&lt;cmd&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Presents summary information about NSH commands to
console.</p>
<p><strong>Options</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 16%" />
<col style="width: 84%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-v</span></code></p></td>
<td><p>how verbose output will full command usage.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">&lt;cmd&gt;</span></code></p></td>
<td><p>Show full command usage only for this command.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="hexadecimal-dump-of-file-or-device-hexdump">
<h3>Hexadecimal Dump of File or Device (hexdump)<a class="headerlink" href="#hexadecimal-dump-of-file-or-device-hexdump" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>hexdump &lt;file or device&gt; [skip=&lt;bytes&gt;] [count=&lt;bytes&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Dump data in hexadecimal format from a file or
character device</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 24%" />
<col style="width: 76%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">skip=&lt;bytes&gt;</span></code></p></td>
<td><p>Will skip &lt;bytes&gt; number of bytes from the beginning.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">count=&lt;bytes&gt;</span></code></p></td>
<td><p>Will stop after dumping &lt;bytes&gt; number of bytes.</p></td>
</tr>
</tbody>
</table>
<p>The <code class="docutils literal notranslate"><span class="pre">skip</span></code> and <code class="docutils literal notranslate"><span class="pre">count</span></code> options are only available if
<code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_CMDOPT_HEXDUMP</span></code> is defined in the NuttX
configuration.</p>
</div>
<div class="section" id="manage-network-configuration-ifconfig">
<h3>Manage Network Configuration (ifconfig)<a class="headerlink" href="#manage-network-configuration-ifconfig" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifconfig [nic_name [&lt;ip-address&gt;|dhcp]] [dr|gw|gateway &lt;dr-address&gt;] [netmask &lt;net-mask&gt;] [dns &lt;dns-address&gt;] [hw &lt;hw-mac&gt;]]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Multiple forms of the <code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> command are
supported:</p>
<blockquote>
<div><ol class="arabic">
<li><p>With one or no arguments, <code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> will shows the current
configuration of the network and, perhaps, the status of
Ethernet device:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifconfig
ifconfig [nic_name]
</pre></div>
</div>
<p>As an example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ifconfig
eth0 HWaddr 00:18:11:80:10:06
IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
</pre></div>
</div>
<p>If network statistics are enabled (<code class="docutils literal notranslate"><span class="pre">CONFIG_NET_STATISTICS</span></code>),
then this command will also show the detailed state of network.</p>
</li>
<li><p>If both the network interface name and an IP address are
supplied as arguments, then <code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> will set the address
of the Ethernet device:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifconfig nic_name ip_address
</pre></div>
</div>
</li>
<li><p>Other forms <em>to be provided</em></p></li>
</ol>
</div></blockquote>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This commands depends upon having the <em>procfs</em> file system
configured into the system. The <em>procfs</em> file system must also
have been mounted with a command like:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mount -t procfs /proc
</pre></div>
</div>
</div>
</div>
<div class="section" id="take-a-network-down-ifdown">
<h3>Take a network down (ifdown)<a class="headerlink" href="#take-a-network-down-ifdown" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifdown &lt;interface&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Take down the interface identified by the name
&lt;interface&gt;.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifdown eth0
</pre></div>
</div>
</div>
<div class="section" id="bring-a-network-up-ifup">
<h3>Bring a network up (ifup)<a class="headerlink" href="#bring-a-network-up-ifup" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifup &lt;interface&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Bring up down the interface identified by the name
&lt;interface&gt;.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifup eth0
</pre></div>
</div>
</div>
<div class="section" id="install-an-os-module-insmod">
<h3>Install an OS module (insmod)<a class="headerlink" href="#install-an-os-module-insmod" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>insmod &lt;file-path&gt; &lt;module-name&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Install the loadable OS module at &lt;file-path&gt; as
module &lt;module-name&gt;.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /mnt/romfs
/mnt/romfs:
dr-xr-xr-x 0 .
-r-xr-xr-x 9153 chardev
nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
crw-rw-rw- 0 ttyS0
nsh&gt; lsmod
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
nsh&gt; insmod /mnt/romfs/chardev mydriver
nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 chardev
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
crw-rw-rw- 0 ttyS0
nsh&gt; lsmod
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
mydriver 20404659 20404625 0 20404580 552 204047a8 0
</pre></div>
</div>
</div>
<div class="section" id="show-interrupt-status-irqinfo">
<h3>Show Interrupt Status (irqinfo)<a class="headerlink" href="#show-interrupt-status-irqinfo" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>irqinfo
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the current count of interrupts taken on all
attached interrupts.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; irqinfo
IRQ HANDLER ARGUMENT COUNT RATE
3 00001b3d 00000000 156 19.122
15 0000800d 00000000 817 100.000
30 00000fd5 20000018 20 2.490
</pre></div>
</div>
</div>
<div class="section" id="send-a-signal-to-a-task-kill">
<h3>Send a signal to a task (kill)<a class="headerlink" href="#send-a-signal-to-a-task-kill" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>kill -&lt;signal&gt; &lt;pid&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Send the &lt;signal&gt; to the task identified by &lt;pid&gt;.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mkfifo /dev/fifo
nsh&gt; cat /dev/fifo &amp;
cat [2:128]
nsh&gt; ps
PID PRI POLICY TYPE NPX STATE EVENT SIGMASK COMMAND
0 0 FIFO Kthread --- Ready 00000000 Idle Task
1 128 RR Task --- Running 00000000 init
2 128 FIFO pthread --- Waiting Semaphore 00000000 &lt;pthread&gt;(51ea50)
nsh&gt; kill -9 2
nsh&gt; ps
PID PRI POLICY TYPE NPX STATE EVENT SIGMASK COMMAND
0 0 FIFO Kthread --- Ready 00000000 Idle Task
1 128 RR Task --- Running 00000000 init
nsh&gt;
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>NuttX does not support a FULL POSIX signaling system. A
few standard signal names like <code class="docutils literal notranslate"><span class="pre">SIGCHLD</span></code>, <code class="docutils literal notranslate"><span class="pre">SIGUSR1</span></code>,
<code class="docutils literal notranslate"><span class="pre">SIGUSR2</span></code>, <code class="docutils literal notranslate"><span class="pre">SIGALRM</span></code>, and <code class="docutils literal notranslate"><span class="pre">SIGPOLL</span></code> exist in the system.
However, they do not have the default actions that you might
expect. Rather, NuttX supports only what are referred to as POSIX
real-time signals. These signals may be used to communicate with
running tasks, may be use to waiting waiting tasks, etc.</p>
<p>If the configuration option <code class="docutils literal notranslate"><span class="pre">CONFIG_SIG_DEFAULT</span></code> is enabled,
then default actions for the <code class="docutils literal notranslate"><span class="pre">SIGINT</span></code> and <code class="docutils literal notranslate"><span class="pre">SIGKILL</span></code> signals
(only) will be supported. In that case, as an example, <code class="docutils literal notranslate"><span class="pre">kill</span> <span class="pre">-9</span></code>
(SIGKILL) will, indeed, terminate a task. Caution should be
exercised, however, because this is likely to cause memory leaks
and to strand resource since there is insufficient clean-up in
certain build configurations.</p>
</div>
</div>
<div class="section" id="setup-teardown-the-loop-device-losetup">
<h3>Setup/teardown the Loop Device (losetup)<a class="headerlink" href="#setup-teardown-the-loop-device-losetup" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax 1</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>losetup [-o &lt;offset&gt;] [-r] &lt;dev-path&gt; &lt;file-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Setup the loop device at &lt;dev-path&gt; to access the
file at &lt;file-path&gt; as a block device. In the following example a
256K file is created (<code class="docutils literal notranslate"><span class="pre">dd</span></code>) and <code class="docutils literal notranslate"><span class="pre">losetup</span></code> is used to make the
file accessible as a block device. A FAT file system is created
(<code class="docutils literal notranslate"><span class="pre">mkfatfs</span></code>) and mounted (<code class="docutils literal notranslate"><span class="pre">mount</span></code>). Files can then be managed
on the loop-mounted file:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; dd if=/dev/zero of=/tmp/image bs=512 count=512
nsh&gt; ls -l /tmp
/tmp:
-rw-rw-rw- 262144 IMAGE
nsh&gt; losetup /dev/loop0 /tmp/image
nsh&gt; ls -l /dev
/dev:
brw-rw-rw- 0 loop0
nsh&gt; mkfatfs /dev/loop0
nsh&gt; mount -t vfat /dev/loop0 /mnt/example
nsh&gt; ls -l /mnt
ls -l /mnt
/mnt:
drw-rw-rw- 0 example/
nsh&gt; echo &quot;This is a test&quot; &gt;/mnt/example/atest.txt
nsh&gt; ls -l /mnt/example
/mnt/example:
-rw-rw-rw- 16 ATEST.TXT
nsh&gt; cat /mnt/example/atest.txt
This is a test
nsh&gt;
</pre></div>
</div>
<p><strong>Command Syntax 2</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>losetup d &lt;dev-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Teardown the setup for the loop device at
&lt;dev-path&gt;.</p>
</div>
<div class="section" id="link-to-a-file-or-directory-ln">
<h3>Link to a File or Directory (ln)<a class="headerlink" href="#link-to-a-file-or-directory-ln" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ln [-s] &lt;target&gt; &lt;link&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. The <code class="docutils literal notranslate"><span class="pre">ln</span></code> command will create a new symbolic link
at &lt;link&gt; for the existing file or directory, &lt;target&gt;. This
implementation is simplified for use with NuttX in these ways:</p>
<blockquote>
<div><ul class="simple">
<li><p>Links may be created only within the NuttX top-level, <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo
file system</a>. No
file system currently supported by NuttX provides symbolic
links.</p></li>
<li><p>For the same reason, only soft links are implemented.</p></li>
<li><p>File privileges are ignored.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c_time</span></code> is not updated.</p></li>
</ul>
</div></blockquote>
</div>
<div class="section" id="list-directory-contents-ls">
<h3>List Directory Contents (ls)<a class="headerlink" href="#list-directory-contents-ls" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ls [-lRs] &lt;dir-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the contents of the directory at
<code class="docutils literal notranslate"><span class="pre">&lt;dir-path&gt;</span></code>. NOTE: <code class="docutils literal notranslate"><span class="pre">&lt;dir-path&gt;</span></code> must refer to a directory and
no other file system object.</p>
<p><strong>Options</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 8%" />
<col style="width: 92%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-R</span></code></p></td>
<td><p>Show the contents of specified directory and all of its sub-directories.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-s</span></code></p></td>
<td><p>Show the size of the files along with the filenames in the listing</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-l</span></code></p></td>
<td><p>Show size and mode information along with the filenames in the listing.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="show-information-about-installed-os-modules-lsmod">
<h3>Show information about installed OS modules (lsmod)<a class="headerlink" href="#show-information-about-installed-os-modules-lsmod" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lsmod
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show information about the currently installed OS
modules. This information includes:</p>
<blockquote>
<div><ul class="simple">
<li><p>The module name assigned to the module when it was installed
(<code class="docutils literal notranslate"><span class="pre">NAME</span></code>, string).</p></li>
<li><p>The address of the module initialization function (<code class="docutils literal notranslate"><span class="pre">INIT</span></code>,
hexadecimal).</p></li>
<li><p>The address of the module un-initialization function
(<code class="docutils literal notranslate"><span class="pre">UNINIT</span></code>, hexadecimal).</p></li>
<li><p>An argument that will be passed to the module un-initialization
function (<code class="docutils literal notranslate"><span class="pre">ARG</span></code>, hexadecimal).</p></li>
<li><p>The start of the .text memory region (<code class="docutils literal notranslate"><span class="pre">TEXT</span></code>, hexadecimal).</p></li>
<li><p>The size of the .text memory region size (<code class="docutils literal notranslate"><span class="pre">SIZE</span></code>, decimal).</p></li>
<li><p>The start of the .bss/.data memory region (<code class="docutils literal notranslate"><span class="pre">DATA</span></code>,
hexadecimal).</p></li>
<li><p>The size of the .bss/.data memory region size (<code class="docutils literal notranslate"><span class="pre">SIZE</span></code>,
decimal).</p></li>
</ul>
</div></blockquote>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; lsmod
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
mydriver 20404659 20404625 0 20404580 552 204047a8 0
</pre></div>
</div>
</div>
<div class="section" id="calculate-md5-md5">
<h3>Calculate MD5 (md5)<a class="headerlink" href="#calculate-md5-md5" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>md5 [-f] &lt;string or filepath&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. <em>To be provided.</em></p>
</div>
<div class="section" id="access-memory-mb-mh-and-mw">
<h3>Access Memory (mb, mh, and mw)<a class="headerlink" href="#access-memory-mb-mh-and-mw" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mb &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
mh &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
mw &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Access memory using byte size access (mb), 16-bit
accesses (mh), or 32-bit access (mw). In each case,</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 34%" />
<col style="width: 66%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">&lt;hex-address&gt;</span></code></p></td>
<td><p>Specifies the address to be accessed. The current
value at that address will always be read and displayed.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">&lt;hex-address&gt;=&lt;hex-value&gt;</span></code></p></td>
<td><p>Read the value, then write &lt;hex-value&gt; to the location.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">&lt;hex-byte-count&gt;</span></code></p></td>
<td><p>Perform the mb, mh, or mw operation on a total of
&lt;hex-byte-count&gt; bytes, increment the &lt;hex-address&gt;
appropriately after each access.</p></td>
</tr>
</tbody>
</table>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mh 0 16
0 = 0x0c1e
2 = 0x0100
4 = 0x0c1e
6 = 0x0110
8 = 0x0c1e
a = 0x0120
c = 0x0c1e
e = 0x0130
10 = 0x0c1e
12 = 0x0140
14 = 0x0c1e
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="show-current-tasks-and-threads-ps">
<h3>Show Current Tasks and Threads (ps)<a class="headerlink" href="#show-current-tasks-and-threads-ps" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ps
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the currently active threads and tasks. For
example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ps
PID PRI POLICY TYPE NPX STATE EVENT SIGMASK COMMAND
0 0 FIFO Kthread --- Ready 00000000 Idle Task
1 128 RR Task --- Running 00000000 init
2 128 FIFO Task --- Waiting Semaphore 00000000 nsh_telnetmain()
3 100 RR pthread --- Waiting Semaphore 00000000 &lt;pthread&gt;(21)
nsh&gt;
</pre></div>
</div>
<p>NOTE: This commands depends upon having the <em>procfs</em> file system
configured into the system. The <em>procfs</em> file system must also
have been mounted with a command like:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mount -t procfs /proc
</pre></div>
</div>
</div>
<div class="section" id="create-a-directory-mkdir">
<h3>Create a Directory (mkdir)<a class="headerlink" href="#create-a-directory-mkdir" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkdir &lt;path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Create the directory at <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code>. All components
of <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code> except the final directory name must exist on a
mounted file system; the final directory must not.</p>
<p><strong>Limited to Mounted File Systems</strong>. Recall that NuttX uses a
<a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file system</a>
for its root file system. The <code class="docutils literal notranslate"><span class="pre">mkdir</span></code> command can only be used
to create directories in volumes set up with the
<code class="docutils literal notranslate"><span class="pre">`mount</span></code> &lt;#cmdmount&gt;`__ command; it cannot be used to create
directories in the <em>pseudo</em> file system.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mkdir /mnt/fs/tmp
nsh&gt; ls -l /mnt/fs
/mnt/fs:
drw-rw-rw- 0 TESTDIR/
drw-rw-rw- 0 TMP/
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="create-a-fat-file-system-mkfatfs">
<h3>Create a FAT File System (mkfatfs)<a class="headerlink" href="#create-a-fat-file-system-mkfatfs" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong></p>
<blockquote>
<div><p>mkfatfs [-F &lt;fatsize&gt;] [-r &lt;rootdirentries&gt;] &lt;block-driver&gt;</p>
</div></blockquote>
<p><strong>Synopsis</strong>. Format a fat file system on the block device
specified by <code class="docutils literal notranslate"><span class="pre">&lt;block-driver&gt;</span></code> path. The FAT size may be provided
as an option. Without the <code class="docutils literal notranslate"><span class="pre">&lt;fatsize&gt;</span></code> option, <code class="docutils literal notranslate"><span class="pre">mkfatfs</span></code> will
select either the FAT12 or FAT16 format. For historical reasons,
if you want the FAT32 format, it must be explicitly specified on
the command line.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">-r</span></code> option may be specified to select the the number of
entries in the root directory for FAT12 and FAT16 file systems.
Typical values for small volumes would be 112 or 224; 512 should
be used for large volumes, such as hard disks or very large SD
cards. The default is 512 entries in all cases.</p>
<p>The reported number of root directory entries used with FAT32 is
zero because the FAT32 root directory is a cluster chain.</p>
<p>NSH provides this command to access the
<code class="docutils literal notranslate"><span class="pre">`mkfatfs()</span></code> &lt;mkfatfs&gt;`__ NuttX API. This block device must
reside in the NuttX <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a> and must have
been created by some call to <code class="docutils literal notranslate"><span class="pre">register_blockdriver()</span></code> (see
<code class="docutils literal notranslate"><span class="pre">include/nuttx/fs/fs.h</span></code>).</p>
</div>
<div class="section" id="create-a-fifo-mkfifo">
<h3>Create a FIFO (mkfifo)<a class="headerlink" href="#create-a-fifo-mkfifo" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkfifo &lt;path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Creates a FIFO character device anywhere in the
pseudo file system, creating whatever pseudo directories that may
be needed to complete the <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code>. By convention, however,
device drivers are place in the standard <code class="docutils literal notranslate"><span class="pre">/dev</span></code> directory. After
it is created, the FIFO device may be used as any other device
driver. NSH provides this command to access the
<code class="docutils literal notranslate"><span class="pre">`mkfifo()</span></code> &lt;NuttxUserGuide.html#mkfifo&gt;`__ NuttX API.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
nsh&gt; mkfifo /dev/fifo
nsh&gt; ls -l /dev
ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 fifo
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="create-a-ramdisk-mkrd">
<h3>Create a RAMDISK (mkrd)<a class="headerlink" href="#create-a-ramdisk-mkrd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkrd [-m &lt;minor&gt;] [-s &lt;sector-size&gt;] &lt;nsectors&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Create a ramdisk consisting of <code class="docutils literal notranslate"><span class="pre">&lt;nsectors&gt;</span></code>, each
of size <code class="docutils literal notranslate"><span class="pre">&lt;sector-size&gt;</span></code> (or 512 bytes if <code class="docutils literal notranslate"><span class="pre">&lt;sector-size&gt;</span></code> is
not specified. The ramdisk will be registered as
<code class="docutils literal notranslate"><span class="pre">/dev/ram&lt;minor&gt;</span></code>. If <code class="docutils literal notranslate"><span class="pre">&lt;minor&gt;</span></code> is not specified, <code class="docutils literal notranslate"><span class="pre">mkrd</span></code>
will attempt to register the ramdisk as <code class="docutils literal notranslate"><span class="pre">/dev/ram0</span></code>.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls /dev
/dev:
console
null
ttyS0
ttyS1
nsh&gt; mkrd 1024
nsh&gt; ls /dev
/dev:
console
null
ram0
ttyS0
ttyS1
nsh&gt;
</pre></div>
</div>
<p>Once the ramdisk has been created, it may be formatted using the
<code class="docutils literal notranslate"><span class="pre">mkfatfs</span></code> command and mounted using the <code class="docutils literal notranslate"><span class="pre">mount</span></code> command.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mkrd 1024
nsh&gt; mkfatfs /dev/ram0
nsh&gt; mount -t vfat /dev/ram0 /tmp
nsh&gt; ls /tmp
/tmp:
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="mount-a-file-system-mount">
<h3>Mount a File System (mount)<a class="headerlink" href="#mount-a-file-system-mount" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mount -t &lt;fstype&gt; [-o &lt;options&gt;] &lt;block-device&gt; &lt;dir-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. The <code class="docutils literal notranslate"><span class="pre">mount</span></code> command performs one of two different
operations. If no parameters are provided on the command line
after the <code class="docutils literal notranslate"><span class="pre">mount</span></code> command, then the <code class="docutils literal notranslate"><span class="pre">mount</span></code> command will
enumerate all of the current mountpoints on the console.</p>
<p>If the mount parameters are provided on the command after the
<code class="docutils literal notranslate"><span class="pre">mount</span></code> command, then the <code class="docutils literal notranslate"><span class="pre">mount</span></code> command will mount a file
system in the NuttX pseudo-file system. <code class="docutils literal notranslate"><span class="pre">mount</span></code> performs a three
way association, binding:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p><strong>File System.</strong> The ‘-t <code class="docutils literal notranslate"><span class="pre">&lt;fstype&gt;</span></code>’ option identifies the
type of file system that has been formatted on the
<code class="docutils literal notranslate"><span class="pre">&lt;block-device&gt;</span></code>. As of this writing, <code class="docutils literal notranslate"><span class="pre">vfat</span></code> is the only
supported value for <code class="docutils literal notranslate"><span class="pre">&lt;fstype&gt;</span></code></p></li>
<li><p><strong>Block Device.</strong> The <code class="docutils literal notranslate"><span class="pre">&lt;block-device&gt;</span></code> argument is the full
or relative path to a block driver inode in the <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a>. By
convention, this is a name under the <code class="docutils literal notranslate"><span class="pre">/dev</span></code> sub-directory.
This <code class="docutils literal notranslate"><span class="pre">&lt;block-device&gt;</span></code> must have been previously formatted
with the same file system type as specified by <code class="docutils literal notranslate"><span class="pre">&lt;fstype&gt;</span></code></p></li>
<li><p><strong>Mount Point.</strong> The mount point, <code class="docutils literal notranslate"><span class="pre">&lt;dir-path&gt;</span></code>, is the
location in the <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a> where the
mounted volume will appear. This mount point can only reside in
the NuttX <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a>. By
convention, this mount point is a subdirectory under <code class="docutils literal notranslate"><span class="pre">/mnt</span></code>.
The mount command will create whatever pseudo directories that
may be needed to complete the full path but the full path must
not already exist.</p></li>
</ol>
</div></blockquote>
<p>After the volume has been mounted in the NuttX <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a>, it may be
access in the same way as other objects in the file system.</p>
<p><strong>Examples</strong>:</p>
<p>Using <code class="docutils literal notranslate"><span class="pre">mount</span></code> to mount a file system:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw- 0 ram0
nsh&gt; ls /mnt
nsh: ls: no such directory: /mnt
nsh&gt; mount -t vfat /dev/ram0 /mnt/fs
nsh&gt; ls -l /mnt/fs/testdir
/mnt/fs/testdir:
-rw-rw-rw- 15 TESTFILE.TXT
nsh&gt; echo &quot;This is a test&quot; &gt;/mnt/fs/testdir/example.txt
nsh&gt; ls -l /mnt/fs/testdir
/mnt/fs/testdir:
-rw-rw-rw- 15 TESTFILE.TXT
-rw-rw-rw- 16 EXAMPLE.TXT
nsh&gt; cat /mnt/fs/testdir/example.txt
This is a test
nsh&gt;
</pre></div>
</div>
<p>Using <code class="docutils literal notranslate"><span class="pre">mount</span></code> to enumerate mounts:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mount
/etc type romfs
/mnt/fs type vfat
/tmp type vfat
</pre></div>
</div>
</div>
<div class="section" id="rename-a-file-mv">
<h3>Rename a File (mv)<a class="headerlink" href="#rename-a-file-mv" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mv &lt;old-path&gt; &lt;new-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Rename the file object at <code class="docutils literal notranslate"><span class="pre">&lt;old-path&gt;</span></code> to
<code class="docutils literal notranslate"><span class="pre">&lt;new-path&gt;</span></code>. Both paths must reside in the same mounted file
system.</p>
</div>
<div class="section" id="mount-an-nfs-file-system-nfsmount">
<h3>Mount an NFS file system (nfsmount)<a class="headerlink" href="#mount-an-nfs-file-system-nfsmount" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nfsmount &lt;server-address&gt; &lt;mount-point&gt; &lt;remote-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Mount the remote NFS server directory&lt;remote-path&gt;
at &lt;mount-point&gt; on the target machine. &lt;server-address&gt; is the IP
address of the remote server.</p>
</div>
<div class="section" id="lookup-a-network-address-nslookup">
<h3>Lookup a network address (nslookup)<a class="headerlink" href="#lookup-a-network-address-nslookup" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nslookup &lt;host-name&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Lookup and print the IP address associated with
<code class="docutils literal notranslate"><span class="pre">&lt;host-name&gt;</span></code>.</p>
</div>
<div class="section" id="change-a-user-s-password-passwd">
<h3>Change a User’s Password (passwd)<a class="headerlink" href="#change-a-user-s-password-passwd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>passwd &lt;username&gt; &lt;password&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Set the password for the existing user &lt;username&gt; to
&lt;password&gt;.</p>
</div>
<div class="section" id="manage-power-management-subsystem-pmconfig">
<h3>Manage Power Management Subsystem (pmconfig)<a class="headerlink" href="#manage-power-management-subsystem-pmconfig" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pmconfig [stay|relax] [normal|idle|standby|sleep]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Control power management subsystem.</p>
</div>
<div class="section" id="shut-the-system-down-poweroff">
<h3>Shut the system down (poweroff)<a class="headerlink" href="#shut-the-system-down-poweroff" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>poweroff [&lt;n&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Shutdown and power off the system immediately. This
command depends on board-specific hardware support to power down
the system. The optional,decimal numeric argument may be included
to provide power off mode to board-specific power off logic.</p>
<p>NOTE: Supporting both the <code class="docutils literal notranslate"><span class="pre">poweroff</span></code> and <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> commands
is redundant.</p>
</div>
<div class="section" id="send-file-via-tftp-put">
<h3>Send File Via TFTP (put)<a class="headerlink" href="#send-file-via-tftp-put" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>put [-b|-n] [-f &lt;remote-path&gt;] -h &lt;ip-address&gt; &lt;local-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Copy the file at <code class="docutils literal notranslate"><span class="pre">&lt;local-address&gt;</span></code> to the host
whose IP address is identified by <code class="docutils literal notranslate"><span class="pre">&lt;ip-address&gt;</span></code>.</p>
<p><strong>Other options:</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 28%" />
<col style="width: 72%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre">&lt;remote-path&gt;</span></code></p></td>
<td><p>The file will be saved relative with the same
name on the host unless &lt;remote-path&gt; is provided.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-b|-n</span></code></p></td>
<td><p>Selects either binary (“octet”) or text (“netascii”)
transfer mode. Default: text.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="show-current-working-directory-pwd">
<h3>Show Current Working Directory (pwd)<a class="headerlink" href="#show-current-working-directory-pwd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pwd
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the current working directory:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; cd /dev
nsh&gt; pwd
/dev
nsh&gt;
</pre></div>
</div>
<p>Same as <code class="docutils literal notranslate"><span class="pre">echo</span> <span class="pre">$PWD</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; echo $PWD
/dev
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="show-target-of-a-link-readlink">
<h3>Show target of a link (readlink)<a class="headerlink" href="#show-target-of-a-link-readlink" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>readlink &lt;link&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the target of the soft link at the path
<code class="docutils literal notranslate"><span class="pre">&lt;link&gt;</span></code>.</p>
</div>
<div class="section" id="reboot-the-system-reboot">
<h3>Reboot the system (reboot)<a class="headerlink" href="#reboot-the-system-reboot" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>reboot [&lt;n&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Reset and reboot the system immediately. This
command depends on hardware support to reset the system. The
optional, decimal numeric argument &lt;n&gt; may be included to provide
a reboot mode to board-specific reboot logic.</p>
<p>NOTE: Supporting both the <code class="docutils literal notranslate"><span class="pre">reboot</span></code> and <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> commands is
redundant.</p>
</div>
<div class="section" id="remove-a-file-rm">
<h3>Remove a File (rm)<a class="headerlink" href="#remove-a-file-rm" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rm &lt;file-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Remove the specified <code class="docutils literal notranslate"><span class="pre">&lt;file-path&gt;</span></code> name from the
mounted file system. Recall that NuttX uses a <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a> for its root
file system. The <code class="docutils literal notranslate"><span class="pre">rm</span></code> command can only be used to remove
(unlink) files in volumes set up with the
<code class="docutils literal notranslate"><span class="pre">`mount</span></code> &lt;#cmdmount&gt;`__ command; it cannot be used to remove
names in the <em>pseudo</em> file system.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls /mnt/fs/testdir
/mnt/fs/testdir:
TESTFILE.TXT
EXAMPLE.TXT
nsh&gt; rm /mnt/fs/testdir/example.txt
nsh&gt; ls /mnt/fs/testdir
/mnt/fs/testdir:
TESTFILE.TXT
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="remove-a-directory-rmdir">
<h3>Remove a Directory (rmdir)<a class="headerlink" href="#remove-a-directory-rmdir" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmdir &lt;dir-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Remove the specified <code class="docutils literal notranslate"><span class="pre">&lt;dir-path&gt;</span></code> directory from
the mounted file system. Recall that NuttX uses a <a class="reference external" href="NuttxUserGuide.html#FileSystemOverview">pseudo file
system</a> for its root
file system. The <code class="docutils literal notranslate"><span class="pre">rmdir</span></code> command can only be used to remove
directories from volumes set up with the <code class="docutils literal notranslate"><span class="pre">`mount</span></code> &lt;#cmdmount&gt;`__
command; it cannot be used to remove directories from the <em>pseudo</em>
file system.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; mkdir /mnt/fs/tmp
nsh&gt; ls -l /mnt/fs
/mnt/fs:
drw-rw-rw- 0 TESTDIR/
drw-rw-rw- 0 TMP/
nsh&gt; rmdir /mnt/fs/tmp
nsh&gt; ls -l /mnt/fs
/mnt/fs:
drw-rw-rw- 0 TESTDIR/
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="remove-on-os-module-rmmod">
<h3>Remove on OS Module (rmmod)<a class="headerlink" href="#remove-on-os-module-rmmod" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmmod &lt;module-name&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Remove the loadable OS module with the
&lt;module-name&gt;. NOTE: An OS module can only be removed if it is not
busy.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; lsmod
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
mydriver 20404659 20404625 0 20404580 552 204047a8 0
nsh&gt; rmmod mydriver
nsh&gt; lsmod
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="show-routing-table-route">
<h3>Show routing table (route)<a class="headerlink" href="#show-routing-table-route" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>route ipv4|ipv6
</pre></div>
</div>
<p><strong>Synopsis</strong>. Show the contents of routing table for IPv4 or IPv6.</p>
<p>If only IPv4 or IPv6 is enabled, then the argument is optional
but, if provided, must match the enabled internet protocol
version.</p>
</div>
<div class="section" id="start-stop-the-openamp-rpc-tunnel-rptun">
<h3>Start/Stop the OpenAMP RPC Tunnel (rptun)<a class="headerlink" href="#start-stop-the-openamp-rpc-tunnel-rptun" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rptun start|stop &lt;dev-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Start or stop the OpenAMP RPC tunnel device at &lt;dev-path&gt;.</p>
</div>
<div class="section" id="set-a-variable-set">
<h3>Set a Variable (set)<a class="headerlink" href="#set-a-variable-set" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set [{+|-}{e|x|xe|ex}] [&lt;name&gt; &lt;value&gt;]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Set the variable <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> to the string <code class="docutils literal notranslate"><span class="pre">&lt;value&gt;</span></code> and
or set NSH parser control options.</p>
<p>For example, a variable may be set like this:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; echo $foobar
nsh&gt; set foobar foovalue
nsh&gt; echo $foobar
foovalue
nsh&gt;
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_VARS</span></code> is selected, the effect of this <code class="docutils literal notranslate"><span class="pre">set</span></code> command
is to set the local NSH variable. Otherwise, the group-wide environment
variable will be set.</p>
<p>If the local NSH variable has already been <em>promoted</em> to an environment
variable via the <code class="docutils literal notranslate"><span class="pre">`export</span></code> &lt;#cmdexport&gt;`__, then the <code class="docutils literal notranslate"><span class="pre">set</span></code> command
will set the value of the environment variable rather than the local NSH
variable.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The Bash shell does not work this way. Bash would set the value
of both the local Bash variable and the environment variable of the
same name to the same value.</p>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_VARS=y</span></code> is selected and no arguments are provided, then
the <code class="docutils literal notranslate"><span class="pre">set</span></code> command will list all of the local NSH variables:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; set
foolbar=foovalue
</pre></div>
</div>
<p>Set the <em>exit on error control</em> and/or <em>print a trace</em> of commands when
parsing scripts in NSH. The settings are in effect from the point of
execution, until they are changed again, or in the case of the
initialization script, the settings are returned to the default settings
when it exits. Included child scripts will run with the parents settings
and changes made in the child script will effect the parent on return.</p>
<blockquote>
<div><ul class="simple">
<li><p>Use <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-e</span></code> to enable and <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">+e</span></code> to disable (ignore) the exit
condition on commands. The default is -e. Errors cause script to
exit.</p></li>
<li><p>Use <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-x</span></code> to enable and <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">+x</span></code> to disable (silence) printing
a trace of the script commands as they are executed. The default is
<code class="docutils literal notranslate"><span class="pre">+x</span></code>: no printing of a trace of script commands as they are
executed.</p></li>
</ul>
</div></blockquote>
<p>Example 1 - no exit on command not found:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set +e
notacommand
</pre></div>
</div>
<p>Example 2 - will exit on command not found:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set -e
notacommand
</pre></div>
</div>
<p>Example 3 - will exit on command not found, and print a trace of the
script commands:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set -ex
</pre></div>
</div>
<p>Example 4 - will exit on command not found, and print a trace of the
script commands and set foobar to foovalue:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set -ex foobar foovalue
nsh&gt; echo $foobar
foovalue
</pre></div>
</div>
</div>
<div class="section" id="execute-an-nsh-script-sh">
<h3>Execute an NSH Script (sh)<a class="headerlink" href="#execute-an-nsh-script-sh" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sh &lt;script-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Execute the sequence of NSH commands in the file referred
to by <code class="docutils literal notranslate"><span class="pre">&lt;script-path&gt;</span></code>.</p>
</div>
<div class="section" id="shut-the-system-down-shutdown">
<h3>Shut the system down (shutdown)<a class="headerlink" href="#shut-the-system-down-shutdown" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>shutdown [--reboot]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Shutdown and power off the system or, optionally, reset
and reboot the system immediately. This command depends on hardware
support to power down or reset the system; one, both, or neither
behavior may be supported.</p>
<p>NOTE: The <code class="docutils literal notranslate"><span class="pre">shutdown</span></code> command duplicates the behavior of the
<code class="docutils literal notranslate"><span class="pre">poweroff</span></code> and <code class="docutils literal notranslate"><span class="pre">eboot</span></code> commands.</p>
</div>
<div class="section" id="wait-for-seconds-sleep">
<h3>Wait for Seconds (sleep)<a class="headerlink" href="#wait-for-seconds-sleep" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sleep &lt;sec&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Pause execution (sleep) for <code class="docutils literal notranslate"><span class="pre">&lt;sec&gt;</span></code> seconds.</p>
</div>
<div class="section" id="time-start-the-telnet-daemon-telnetd">
<h3>Time Start the Telnet Daemon (telnetd)<a class="headerlink" href="#time-start-the-telnet-daemon-telnetd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>telnetd
</pre></div>
</div>
<p><strong>Synopsis</strong>. Start the Telnet daemon if it is not already running.</p>
<p>The Telnet daemon may be started either programmatically by calling
<code class="docutils literal notranslate"><span class="pre">nsh_telnetstart()</span></code> or it may be started from the NSH command line
using this <code class="docutils literal notranslate"><span class="pre">telnetd</span></code> command.</p>
<p>Normally this command would be suppressed with
<code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_DISABLE_TELNETD</span></code> because the Telnet daemon is
automatically started in <code class="docutils literal notranslate"><span class="pre">nsh_main.c</span></code>. The exception is when
<code class="docutils literal notranslate"><span class="pre">CONFIG_NSH_NETLOCAL</span></code> is selected. In that case, the network is not
enabled at initialization but rather must be enabled from the NSH
command line or via other applications.</p>
<p>In that case, when <code class="docutils literal notranslate"><span class="pre">nsh_telnetstart()</span></code> is called before the the
network is initialized, it will fail.</p>
</div>
<div class="section" id="time-execution-of-another-command-time">
<h3>Time execution of another command (time)<a class="headerlink" href="#time-execution-of-another-command-time" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>time &quot;&lt;command&gt;&quot;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Perform command timing. This command will execute the
following &lt;command&gt; string and then show how much time was required to
execute the command. Time is shown with a resolution of 100 microseconds
which may be beyond the resolution of many configurations. Note that the
&lt;command&gt; must be enclosed in quotation marks if it contains spaces or
other delimiters.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; time &quot;sleep 2&quot;
2.0100 sec
nsh&gt;
</pre></div>
</div>
<p>The additional 10 milliseconds in this example is due to the way that
the sleep command works: It always waits one system clock tick longer
than requested and this test setup used a 10 millisecond periodic system
timer. Sources of error could include various quantization errors,
competing CPU usage, and the additional overhead of the time command
execution itself which is included in the total.</p>
<p>The reported time is the elapsed time from starting of the command to
completion of the command. This elapsed time may not necessarily be just
the processing time for the command. It may included interrupt level
processing, for example. In a busy system, command processing could be
delayed if pre-empted by other, higher priority threads competing for
CPU time. So the reported time includes all CPU processing from the
start of the command to its finish possibly including unrelated
processing time during that interval.</p>
<p>Notice that:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; time &quot;sleep 2 &amp;&quot;
sleep [3:100]
0.0000 sec
nsh&gt;
</pre></div>
</div>
<p>Since the sleep command is executed in background, the sleep command
completes almost immediately. As opposed to the following where the time
command is run in background with the sleep command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; time &quot;sleep 2&quot; &amp;
time [3:100]
nsh&gt;
2.0100 sec
</pre></div>
</div>
</div>
<div class="section" id="set-the-size-of-a-file-truncate">
<h3>Set the Size of a File (truncate)<a class="headerlink" href="#set-the-size-of-a-file-truncate" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>truncate -s &lt;length&gt; &lt;file-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Shrink or extend the size of the regular file at
&lt;file-path&gt; to the specified&lt;length&gt;.</p>
<p>A &lt;file-path&gt; argument that does not exist is created. The &lt;length&gt;
option is NOT optional.</p>
<p>If a &lt;file-path&gt; is larger than the specified size, the extra data is
lost. If a &lt;file-path&gt; is shorter, it is extended and the extended part
reads as zero bytes.</p>
</div>
<div class="section" id="unmount-a-file-system-umount">
<h3>Unmount a File System (umount)<a class="headerlink" href="#unmount-a-file-system-umount" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>umount &lt;dir-path&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Un-mount the file system at mount point <code class="docutils literal notranslate"><span class="pre">&lt;dir-path&gt;</span></code>.
The <code class="docutils literal notranslate"><span class="pre">umount</span></code> command can only be used to un-mount volumes previously
mounted using <code class="docutils literal notranslate"><span class="pre">`mount</span></code> &lt;#cmdmount&gt;`__ command.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ls /mnt/fs
/mnt/fs:
TESTDIR/
nsh&gt; umount /mnt/fs
nsh&gt; ls /mnt/fs
/mnt/fs:
nsh: ls: no such directory: /mnt/fs
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="print-system-information-uname">
<h3>Print system information (uname)<a class="headerlink" href="#print-system-information-uname" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>uname [-a | -imnoprsv]
</pre></div>
</div>
<p><strong>Synopsis</strong>. Print certain system information. With no options, the
output is the same as -s.</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 14%" />
<col style="width: 86%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-a</span></code></p></td>
<td><p>Print all information, in the following
order, except omit -p and -i if unknown:</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-s,</span> <span class="pre">-o</span></code></p></td>
<td><p>Print the operating system name (NuttX)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-n</span></code></p></td>
<td><p>Print the network node hostname (only available if CONFIG_NET=y)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-r</span></code></p></td>
<td><p>Print the kernel release</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-v</span></code></p></td>
<td><p>Print the kernel version</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-m</span></code></p></td>
<td><p>Print the machine hardware name</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-i</span></code></p></td>
<td><p>Print the machine platform name</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-p</span></code></p></td>
<td><p>Print “unknown”</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="unset-an-environment-variable-unset">
<h3>Unset an Environment Variable (unset)<a class="headerlink" href="#unset-an-environment-variable-unset" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<blockquote>
<div><p>unset &lt;name&gt;</p>
</div></blockquote>
<p><strong>Synopsis</strong>. Remove the value associated with the variable <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code>.
This will remove the name-value pair from both the NSH local variables
and the group-wide environment variables. For example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; echo $foobar
foovalue
nsh&gt; unset foobar
nsh&gt; echo $foobar
nsh&gt;
</pre></div>
</div>
</div>
<div class="section" id="url-decode-urldecode">
<h3>URL Decode (urldecode)<a class="headerlink" href="#url-decode-urldecode" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>urldecode [-f] &lt;string or filepath&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. <em>To be provided.</em></p>
</div>
<div class="section" id="url-encode-urlencode">
<h3>URL Encode (urlencode)<a class="headerlink" href="#url-encode-urlencode" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>urlencode [-f] &lt;string or filepath&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. <em>To be provided.</em></p>
</div>
<div class="section" id="add-a-new-user-useradd">
<h3>Add a New User (useradd)<a class="headerlink" href="#add-a-new-user-useradd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>useradd &lt;username&gt; &lt;password&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Add a new user with &lt;username&gt; and &lt;password&gt;.</p>
</div>
<div class="section" id="delete-a-user-userdel">
<h3>Delete a user (userdel)<a class="headerlink" href="#delete-a-user-userdel" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>userdel &lt;username&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Delete the user with the name &lt;username&gt;.</p>
</div>
<div class="section" id="wait-for-microseconds-usleep">
<h3>Wait for Microseconds (usleep)<a class="headerlink" href="#wait-for-microseconds-usleep" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>usleep &lt;usec&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Pause execution (sleep) of <code class="docutils literal notranslate"><span class="pre">&lt;usec&gt;</span></code> microseconds.</p>
</div>
<div class="section" id="get-file-via-http-wget">
<h3>Get File Via HTTP (wget)<a class="headerlink" href="#get-file-via-http-wget" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong></p>
<blockquote>
<div><p>wget [-o &lt;local-path&gt;] &lt;url&gt;</p>
</div></blockquote>
<p><strong>Synopsis</strong>. Use HTTP to copy the file at <code class="docutils literal notranslate"><span class="pre">&lt;url&gt;</span></code> to the current
directory.</p>
<p><strong>Options</strong></p>
<table class="docutils align-default">
<colgroup>
<col style="width: 26%" />
<col style="width: 74%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-o</span> <span class="pre">&lt;local-path&gt;</span></code></p></td>
<td><p>The file will be saved relative to the current working
directory and with the same name as on the HTTP server
unless &lt;local-path&gt; is provided.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="hexadecimal-dump-of-memory-xd">
<h3>Hexadecimal Dump of Memory (xd)<a class="headerlink" href="#hexadecimal-dump-of-memory-xd" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>xd &lt;hex-address&gt; &lt;byte-count&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Dump <code class="docutils literal notranslate"><span class="pre">&lt;byte-count&gt;</span></code> bytes of data from address
<code class="docutils literal notranslate"><span class="pre">&lt;hex-address&gt;</span></code>.</p>
<p><strong>Example</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; xd 410e0 512
Hex dump:
0000: 00 00 00 00 9c 9d 03 00 00 00 00 01 11 01 10 06 ................
0010: 12 01 11 01 25 08 13 0b 03 08 1b 08 00 00 02 24 ....%..........$
...
01f0: 08 3a 0b 3b 0b 49 13 00 00 04 13 01 01 13 03 08 .:.;.I..........
nsh&gt;
</pre></div>
</div>
<div class="section" id="built-in-commands">
<h4>Built-In Commands<a class="headerlink" href="#built-in-commands" title="Permalink to this headline"></a></h4>
<p>In addition to the commands that are part of NSH listed in the previous
section above, there can be additional, external <em>built-in</em> applications
that can be added to NSH. These are separately excecuble programs but
will appear much like the commands that are a part of NSH. The primary
difference from the user’s perspective is that help information about
the built-in applications is not available directly from NSH. Rather,
you will need to execute the application with the <code class="docutils literal notranslate"><span class="pre">-h</span></code> option to get
help about using the built-in applications.</p>
<p>There are several built-in applications in the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> repository. No
attempt is made here to enumerate all of them. But a few of the more
common, useful built-in applications are listed below.</p>
</div>
</div>
<div class="section" id="check-network-peer-ping-ping6">
<h3>Check Network Peer (ping/ping6)<a class="headerlink" href="#check-network-peer-ping-ping6" title="Permalink to this headline"></a></h3>
<p><strong>Command Syntax</strong>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ping [-c &lt;count&gt;] [-i &lt;interval&gt;] &lt;ip-address&gt;
ping6 [-c &lt;count&gt;] [-i &lt;interval&gt;] &lt;ip-address&gt;
</pre></div>
</div>
<p><strong>Synopsis</strong>. Test the network communication with a remote peer.
Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; ping 10.0.0.1
PING 10.0.0.1 56 bytes of data
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10190 ms
nsh&gt;
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">ping6</span></code> differs from <code class="docutils literal notranslate"><span class="pre">ping</span></code> in that it uses IPv6 addressing.</p>
</div>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2020, The Apache Software Foundation
</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>