| <!-- |
| 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="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>Commands — NuttX latest documentation</title> |
| <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/css/theme.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/copybutton.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/custom.css" /> |
| |
| |
| <link rel="shortcut icon" href="../../_static/favicon.ico"/> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| <script src="../../_static/sphinx_highlight.js"></script> |
| <script src="../../_static/clipboard.min.js"></script> |
| <script src="../../_static/copybutton.js"></script> |
| <script src="../../_static/design-tabs.js"></script> |
| <script 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 |
| |
| |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../12.11.0" >12.11.0</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" aria-label="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="Navigation menu"> |
| <p class="caption" role="heading"><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="../../quickstart/index.html">Getting Started</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="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../components/index.html">OS Components</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">Applications</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../audioutils/index.html">Audio Utility libraries</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../boot/index.html">Bootloader Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../benchmarks/index.html">Benchmark Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../canutils/index.html">CAN Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../crypto/index.html">Cryptography Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../fsutils/index.html">File System Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../games/index.html">Games</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../graphics/index.html">Graphics Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../industry/index.html">Industrial Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../inertial/index.html">Inertial Libraries Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../interpreters/index.html">Interpreters</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../logging/index.html">Logging Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../lte/index.html">LTE Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../math/index.html">Math Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../mlearing/index.html">Machine Learning Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../netutils/index.html">Network Utilities</a></li> |
| <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="#test-evaluate-expression"><code class="docutils literal notranslate"><span class="pre">test</span></code> Evaluate Expression</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#addroute-add-a-routing-table-entry"><code class="docutils literal notranslate"><span class="pre">addroute</span></code> Add a Routing Table Entry</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#arp-access-the-arp-table"><code class="docutils literal notranslate"><span class="pre">arp</span></code> Access the ARP table</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#base64dec-base64-decode"><code class="docutils literal notranslate"><span class="pre">base64dec</span></code> Base64 Decode</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#base64enc-base64-encode"><code class="docutils literal notranslate"><span class="pre">base64enc</span></code> Base64 Encode</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#basename-extract-base-file-directory-name"><code class="docutils literal notranslate"><span class="pre">basename</span></code> Extract Base File/Directory Name</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#break-terminate-a-loop"><code class="docutils literal notranslate"><span class="pre">break</span></code> Terminate a Loop</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#cat-concatenate-files"><code class="docutils literal notranslate"><span class="pre">cat</span></code> Concatenate Files</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#cd-change-current-working-directory"><code class="docutils literal notranslate"><span class="pre">cd</span></code> Change Current Working Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#cmp-compare-files"><code class="docutils literal notranslate"><span class="pre">cmp</span></code> Compare Files</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#cp-copy-files"><code class="docutils literal notranslate"><span class="pre">cp</span></code> Copy Files</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#date-show-or-set-the-date-and-time"><code class="docutils literal notranslate"><span class="pre">date</span></code> Show or set the date and time</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#dd-copy-and-convert-files"><code class="docutils literal notranslate"><span class="pre">dd</span></code> Copy and Convert Files</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#delroute-delete-a-routing-table-entry"><code class="docutils literal notranslate"><span class="pre">delroute</span></code> Delete a Routing Table Entry</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#df-show-volume-status"><code class="docutils literal notranslate"><span class="pre">df</span></code> Show Volume Status</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#dirname-extract-path-to-a-file-directory"><code class="docutils literal notranslate"><span class="pre">dirname</span></code> Extract Path to a File/Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#dmesg-dump-buffered-syslog-output"><code class="docutils literal notranslate"><span class="pre">dmesg</span></code> Dump Buffered SYSLOG Output</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#echo-echo-strings-and-variables"><code class="docutils literal notranslate"><span class="pre">echo</span></code> Echo Strings and Variables</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#env-show-environment-variables"><code class="docutils literal notranslate"><span class="pre">env</span></code> Show Environment Variables</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#exec-execute-user-code"><code class="docutils literal notranslate"><span class="pre">exec</span></code> Execute User Code</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#exit-exit-nsh"><code class="docutils literal notranslate"><span class="pre">exit</span></code> Exit NSH</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#export-set-an-environment-variable"><code class="docutils literal notranslate"><span class="pre">export</span></code> Set an Environment Variable</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#expr-evaluate-expressions"><code class="docutils literal notranslate"><span class="pre">expr</span></code> Evaluate expressions</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#free-show-memory-manager-status"><code class="docutils literal notranslate"><span class="pre">free</span></code> Show Memory Manager Status</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#get-get-file-via-tftp"><code class="docutils literal notranslate"><span class="pre">get</span></code> Get File Via TFTP</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#help-show-usage-command-usage"><code class="docutils literal notranslate"><span class="pre">help</span></code> Show Usage Command Usage</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#hexdump-hexadecimal-dump-of-file-or-device"><code class="docutils literal notranslate"><span class="pre">hexdump</span></code> Hexadecimal Dump of File or Device</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ifconfig-manage-network-configuration"><code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> Manage Network Configuration</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ifdown-take-a-network-down"><code class="docutils literal notranslate"><span class="pre">ifdown</span></code> Take a network down</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ifup-bring-a-network-up"><code class="docutils literal notranslate"><span class="pre">ifup</span></code> Bring a network up</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#insmod-install-an-os-module"><code class="docutils literal notranslate"><span class="pre">insmod</span></code> Install an OS module</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#irqinfo-show-interrupt-status"><code class="docutils literal notranslate"><span class="pre">irqinfo</span></code> Show Interrupt Status</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#critmon-show-critical-monitor-status"><code class="docutils literal notranslate"><span class="pre">critmon</span></code> Show Critical Monitor Status</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#kill-send-a-signal-to-a-task"><code class="docutils literal notranslate"><span class="pre">kill</span></code> Send a signal to a task</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#losetup-setup-teardown-the-loop-device"><code class="docutils literal notranslate"><span class="pre">losetup</span></code> Setup/teardown the Loop Device</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ln-link-to-a-file-or-directory"><code class="docutils literal notranslate"><span class="pre">ln</span></code> Link to a File or Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ls-list-directory-contents"><code class="docutils literal notranslate"><span class="pre">ls</span></code> List Directory Contents</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#lsmod-show-information-about-installed-os-modules"><code class="docutils literal notranslate"><span class="pre">lsmod</span></code> Show information about installed OS modules</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#md5-calculate-md5"><code class="docutils literal notranslate"><span class="pre">md5</span></code> Calculate MD5</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mb-mh-and-mw-access-memory"><code class="docutils literal notranslate"><span class="pre">mb</span></code>, <code class="docutils literal notranslate"><span class="pre">mh</span></code>, <code class="docutils literal notranslate"><span class="pre">and</span></code> <code class="docutils literal notranslate"><span class="pre">mw</span></code> Access Memory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ps-show-current-tasks-and-threads"><code class="docutils literal notranslate"><span class="pre">ps</span></code> Show Current Tasks and Threads</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mkdir-create-a-directory"><code class="docutils literal notranslate"><span class="pre">mkdir</span></code> Create a Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mkfatfs-create-a-fat-file-system"><code class="docutils literal notranslate"><span class="pre">mkfatfs</span></code> Create a FAT File System</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mkfifo-create-a-fifo"><code class="docutils literal notranslate"><span class="pre">mkfifo</span></code> Create a FIFO</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mkrd-create-a-ramdisk"><code class="docutils literal notranslate"><span class="pre">mkrd</span></code> Create a RAMDISK</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mount-mount-a-file-system"><code class="docutils literal notranslate"><span class="pre">mount</span></code> Mount a File System</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#mv-rename-a-file"><code class="docutils literal notranslate"><span class="pre">mv</span></code> Rename a File</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#nfsmount-mount-an-nfs-file-system"><code class="docutils literal notranslate"><span class="pre">nfsmount</span></code> Mount an NFS file system</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#nslookup-lookup-a-network-address"><code class="docutils literal notranslate"><span class="pre">nslookup</span></code> Lookup a network address</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#passwd-change-a-user-s-password"><code class="docutils literal notranslate"><span class="pre">passwd</span></code> Change a User’s Password</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#pmconfig-manage-power-management-subsystem"><code class="docutils literal notranslate"><span class="pre">pmconfig</span></code> Manage Power Management Subsystem</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#poweroff-shut-the-system-down"><code class="docutils literal notranslate"><span class="pre">poweroff</span></code> Shut the system down</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#put-send-file-via-tftp"><code class="docutils literal notranslate"><span class="pre">put</span></code> Send File Via TFTP</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#pwd-show-current-working-directory"><code class="docutils literal notranslate"><span class="pre">pwd</span></code> Show Current Working Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#readlink-show-target-of-a-link"><code class="docutils literal notranslate"><span class="pre">readlink</span></code> Show target of a link</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#reboot-reboot-the-system"><code class="docutils literal notranslate"><span class="pre">reboot</span></code> Reboot the system</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#rm-remove-a-file"><code class="docutils literal notranslate"><span class="pre">rm</span></code> Remove a File</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#rmdir-remove-a-directory"><code class="docutils literal notranslate"><span class="pre">rmdir</span></code> Remove a Directory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#rmmod-remove-on-os-module"><code class="docutils literal notranslate"><span class="pre">rmmod</span></code> Remove on OS Module</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#route-show-routing-table"><code class="docutils literal notranslate"><span class="pre">route</span></code> Show routing table</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#rptun-start-stop-the-openamp-rpc-tunnel"><code class="docutils literal notranslate"><span class="pre">rptun</span></code> Start/Stop the OpenAMP RPC Tunnel</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#set-set-a-variable"><code class="docutils literal notranslate"><span class="pre">set</span></code> Set a Variable</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#sh-execute-an-nsh-script"><code class="docutils literal notranslate"><span class="pre">sh</span></code> Execute an NSH Script</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#shutdown-shut-the-system-down"><code class="docutils literal notranslate"><span class="pre">shutdown</span></code> Shut the system down</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#sleep-wait-for-seconds"><code class="docutils literal notranslate"><span class="pre">sleep</span></code> Wait for Seconds</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#telnetd-time-start-the-telnet-daemon"><code class="docutils literal notranslate"><span class="pre">telnetd</span></code> Time Start the Telnet Daemon</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#time-time-execution-of-another-command"><code class="docutils literal notranslate"><span class="pre">time</span></code> Time execution of another command</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#truncate-set-the-size-of-a-file"><code class="docutils literal notranslate"><span class="pre">truncate</span></code> Set the Size of a File</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#umount-unmount-a-file-system"><code class="docutils literal notranslate"><span class="pre">umount</span></code> Unmount a File System</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#uname-print-system-information"><code class="docutils literal notranslate"><span class="pre">uname</span></code> Print system information</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#unset-unset-an-environment-variable"><code class="docutils literal notranslate"><span class="pre">unset</span></code> Unset an Environment Variable</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#uptime-show-how-long-the-system-has-been-running"><code class="docutils literal notranslate"><span class="pre">uptime</span></code> Show how long the system has been running</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#urldecode-url-decode"><code class="docutils literal notranslate"><span class="pre">urldecode</span></code> URL Decode</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#urlencode-url-encode"><code class="docutils literal notranslate"><span class="pre">urlencode</span></code> URL Encode</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#useradd-add-a-new-user"><code class="docutils literal notranslate"><span class="pre">useradd</span></code> Add a New User</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#userdel-delete-a-user"><code class="docutils literal notranslate"><span class="pre">userdel</span></code> Delete a user</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#usleep-wait-for-microseconds"><code class="docutils literal notranslate"><span class="pre">usleep</span></code> Wait for Microseconds</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#wget-get-file-via-http"><code class="docutils literal notranslate"><span class="pre">wget</span></code> Get File Via HTTP</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#xd-hexadecimal-dump-of-memory"><code class="docutils literal notranslate"><span class="pre">xd</span></code> Hexadecimal Dump of Memory</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#built-in-commands">Built-In Commands</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#ping-and-ping6-check-network-peer"><code class="docutils literal notranslate"><span class="pre">ping</span></code> and <code class="docutils literal notranslate"><span class="pre">ping6</span></code> Check Network Peer</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">The NSH Library and NSH Initialization</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="customizing.html#nsh-commands">NSH Commands</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> |
| <li class="toctree-l3"><a class="reference internal" href="running_apps.html">Running Applications from NSH</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../sdr/index.html">Software Define Radio Libraries</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../system/index.html">System Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../testing/index.html">Testing</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../tools/index.html">Host Side Tools</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../wireless/index.html">Wireless Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../examples/index.html">Examples</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../implementation/index.html">Implementation Details</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="../../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../debugging/index.html">Debugging</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="../../glossary.html">Glossary</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../logos/index.html">NuttX Logos</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../_tags/tagsindex.html">Tags</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <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="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="../index.html">Applications</a></li> |
| <li class="breadcrumb-item"><a href="index.html">NuttShell (NSH)</a></li> |
| <li class="breadcrumb-item active">Commands</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="https://github.com/apache/nuttx/blob/master/Documentation/applications/nsh/commands.rst" class="fa fa-github"> Edit on GitHub</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="commands"> |
| <h1>Commands<a class="headerlink" href="#commands" title="Permalink to this heading"></a></h1> |
| <section id="test-evaluate-expression"> |
| <span id="cmdtest"></span><h2><code class="docutils literal notranslate"><span class="pre">test</span></code> Evaluate Expression<a class="headerlink" href="#test-evaluate-expression" title="Permalink to this heading"></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"><</span>expression> <span class="o">]</span> |
| <span class="k">test</span> <span class="o"><</span>expression> |
| </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> |
| </section> |
| <section id="addroute-add-a-routing-table-entry"> |
| <span id="cmdaddroute"></span><h2><code class="docutils literal notranslate"><span class="pre">addroute</span></code> Add a Routing Table Entry<a class="headerlink" href="#addroute-add-a-routing-table-entry" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax:</strong></p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>addroute <target> [<netmask>] <router> |
| addroute default <ipaddr> <interface> |
| </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 |
| (<router>) to an external network characterized by the <target> IP |
| address and a network mask <netmask></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> 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> 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> |
| </section> |
| <section id="arp-access-the-arp-table"> |
| <span id="cmdarp"></span><h2><code class="docutils literal notranslate"><span class="pre">arp</span></code> Access the ARP table<a class="headerlink" href="#arp-access-the-arp-table" title="Permalink to this heading"></a></h2> |
| <p><strong>Command syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>arp [-t|-a <ipaddr> |-d <ipaddr> |-s <ipaddr> <hwaddr>] |
| </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><ipaddr></var></span></kbd></dt> |
| <dd><p>Will show the hardware address that the IP address <ipaddr> is |
| mapped to.</p> |
| </dd> |
| <dt><kbd><span class="option">-d <var><ipaddr></var></span></kbd></dt> |
| <dd><p>Will delete the mapping for the IP address <ipaddr> from the |
| ARP table.</p> |
| </dd> |
| <dt><kbd><span class="option">-s <var><ipaddr hwaddr></var></span></kbd></dt> |
| <dd><p>Will set (or replace) the mapping of the IP address <ipaddr> to |
| the hardware address <hwaddr>.</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> arp -a 10.0.0.1 |
| nsh: arp: no such ARP entry: 10.0.0.1 |
| |
| nsh> arp -s 10.0.0.1 00:13:3b:12:73:e6 |
| nsh> arp -a 10.0.0.1 |
| HWAddr: 00:13:3b:12:73:e6 |
| |
| nsh> arp -d 10.0.0.1 |
| nsh> arp -a 10.0.0.1 |
| nsh: arp: no such ARP entry: 10.0.0.1 |
| </pre></div> |
| </div> |
| </section> |
| <section id="base64dec-base64-decode"> |
| <span id="cmdbase64dec"></span><h2><code class="docutils literal notranslate"><span class="pre">base64dec</span></code> Base64 Decode<a class="headerlink" href="#base64dec-base64-decode" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>base64dec [-w] [-f] <string or filepath> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. <em>To be provided.</em></p> |
| </section> |
| <section id="base64enc-base64-encode"> |
| <span id="cmdbase64enc"></span><h2><code class="docutils literal notranslate"><span class="pre">base64enc</span></code> Base64 Encode<a class="headerlink" href="#base64enc-base64-encode" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>base64enc [-w] [-f] <string or filepath> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. <em>To be provided.</em></p> |
| </section> |
| <section id="basename-extract-base-file-directory-name"> |
| <span id="cmdbasename"></span><h2><code class="docutils literal notranslate"><span class="pre">basename</span></code> Extract Base File/Directory Name<a class="headerlink" href="#basename-extract-base-file-directory-name" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>basename <path> [<suffix>] |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Extract the final string from a <code class="docutils literal notranslate"><span class="pre"><path></span></code> by |
| removing the preceding path segments and (optionally) removing any |
| trailing <code class="docutils literal notranslate"><span class="pre"><suffix></span></code>.</p> |
| </section> |
| <section id="break-terminate-a-loop"> |
| <span id="cmdbreak"></span><h2><code class="docutils literal notranslate"><span class="pre">break</span></code> Terminate a Loop<a class="headerlink" href="#break-terminate-a-loop" title="Permalink to this heading"></a></h2> |
| <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 <code class="docutils literal notranslate"><span class="pre">while</span></code> or <code class="docutils literal notranslate"><span class="pre">until</span></code> 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> |
| </section> |
| <section id="cat-concatenate-files"> |
| <span id="cmdcat"></span><h2><code class="docutils literal notranslate"><span class="pre">cat</span></code> Concatenate Files<a class="headerlink" href="#cat-concatenate-files" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cat <path> [<path> [<path> ...]] |
| </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"><path></span></code> to the console (or to another file if the |
| output is redirected).</p> |
| </section> |
| <section id="cd-change-current-working-directory"> |
| <span id="cmdcd"></span><h2><code class="docutils literal notranslate"><span class="pre">cd</span></code> Change Current Working Directory<a class="headerlink" href="#cd-change-current-working-directory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd [<dir-path>|-|~|..] |
| </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"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">cd</span> <span class="pre"><dir-path></span></code></p></td> |
| <td><p>sets the current working directory to <dir-path>.</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_LIBC_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> |
| </section> |
| <section id="cmp-compare-files"> |
| <span id="cmdcmp"></span><h2><code class="docutils literal notranslate"><span class="pre">cmp</span></code> Compare Files<a class="headerlink" href="#cmp-compare-files" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cmp <path1> <path2> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Compare of the contents of the file at <code class="docutils literal notranslate"><span class="pre"><path1></span></code> |
| with the contents of the file at <code class="docutils literal notranslate"><span class="pre"><path2></span></code>. Returns an |
| indication only if the files differ.</p> |
| </section> |
| <section id="cp-copy-files"> |
| <span id="cmdcp"></span><h2><code class="docutils literal notranslate"><span class="pre">cp</span></code> Copy Files<a class="headerlink" href="#cp-copy-files" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cp <source-path> <dest-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Copy of the contents of the file at |
| <code class="docutils literal notranslate"><span class="pre"><source-path></span></code> to the location in the file system indicated by |
| <code class="docutils literal notranslate"><span class="pre"><dest-path></span></code>.</p> |
| </section> |
| <section id="date-show-or-set-the-date-and-time"> |
| <span id="cmddate"></span><h2><code class="docutils literal notranslate"><span class="pre">date</span></code> Show or set the date and time<a class="headerlink" href="#date-show-or-set-the-date-and-time" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>date [-s "MMM DD HH:MM:SS YYYY"] [-u] [+%format] |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Show or set the current date and time or UTC with <code class="docutils literal notranslate"><span class="pre">-u</span></code> option, |
| and support format output with <code class="docutils literal notranslate"><span class="pre">+%format</span></code>.</p> |
| <p>To show the current system time and date, type in the <code class="docutils literal notranslate"><span class="pre">date</span></code> command. |
| The output displays the day of the week, day of the month, month, year, |
| current time. 24-hour time is used. |
| Only one format is used, both on display and when setting the date/time. |
| To change the system clock manually, type <code class="docutils literal notranslate"><span class="pre">date</span> <span class="pre">-s</span> <span class="pre">MMM</span> <span class="pre">DD</span> <span class="pre">HH:MM:SS</span> <span class="pre">YYYY</span></code>.</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">MMM</span></code> Short month name (e.g., Sep).</p></li> |
| <li><p>Space separator.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">DD</span></code> Day of month (e.g., 01).</p></li> |
| <li><p>Space separator.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">HH</span></code> Hour (00-23).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">:</span></code> Colon separator.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">MM</span></code> Minute (00-59).</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">:</span></code> Colon separator.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SS</span></code> Second (00-60).</p></li> |
| <li><p>Space separator</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">YYYY</span></code> Year (e.g., 2023).</p></li> |
| </ul> |
| </div></blockquote> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> date |
| Thu, Jan 01 00:00:17 1970 |
| nsh> date -s "Sep 15 11:30:00 2023" |
| nsh> date |
| Fri, Sep 15 11:30:03 2023 |
| </pre></div> |
| </div> |
| </section> |
| <section id="dd-copy-and-convert-files"> |
| <span id="cmddd"></span><h2><code class="docutils literal notranslate"><span class="pre">dd</span></code> Copy and Convert Files<a class="headerlink" href="#dd-copy-and-convert-files" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dd if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>] |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Copy blocks from <infile> to <outfile>. <infile> or |
| <outfile> 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> ls -l /dev |
| /dev: |
| crw-rw-rw- 0 zero |
| nsh> dd if=/dev/zero of=/tmp/zeros bs=64 count=16 |
| nsh> 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> ls -l /dev |
| /dev: |
| brw-rw-rw- 0 ram0 |
| crw-rw-rw- 0 zero |
| nsh> 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> ls -l /dev |
| /dev: |
| crw-rw-rw- 0 null |
| brw-rw-rw- 0 ram0 |
| nsh> dd if=/dev/ram0 of=/dev/null |
| </pre></div> |
| </div> |
| </section> |
| <section id="delroute-delete-a-routing-table-entry"> |
| <span id="cmddelroute"></span><h2><code class="docutils literal notranslate"><span class="pre">delroute</span></code> Delete a Routing Table Entry<a class="headerlink" href="#delroute-delete-a-routing-table-entry" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>delroute <target> [<netmask>] |
| </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 <target> IP address and the network mask <netmask></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> 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> delroute 11.0.0.0/24 |
| </pre></div> |
| </div> |
| </section> |
| <section id="df-show-volume-status"> |
| <span id="cmddf"></span><h2><code class="docutils literal notranslate"><span class="pre">df</span></code> Show Volume Status<a class="headerlink" href="#df-show-volume-status" title="Permalink to this heading"></a></h2> |
| <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> mount |
| /etc type romfs |
| /tmp type vfat |
| nsh> df |
| Block Number |
| Size Blocks Used Available Mounted on |
| 64 6 6 0 /etc |
| 512 985 2 983 /tmp |
| nsh> |
| </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> |
| </section> |
| <section id="dirname-extract-path-to-a-file-directory"> |
| <span id="cmddirname"></span><h2><code class="docutils literal notranslate"><span class="pre">dirname</span></code> Extract Path to a File/Directory<a class="headerlink" href="#dirname-extract-path-to-a-file-directory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dirname <path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Extract the path string leading up to the full |
| <code class="docutils literal notranslate"><span class="pre"><path></span></code> by removing the final directory or file name.</p> |
| </section> |
| <section id="dmesg-dump-buffered-syslog-output"> |
| <span id="cmddmesg"></span><h2><code class="docutils literal notranslate"><span class="pre">dmesg</span></code> Dump Buffered SYSLOG Output<a class="headerlink" href="#dmesg-dump-buffered-syslog-output" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="echo-echo-strings-and-variables"> |
| <span id="cmdecho"></span><h2><code class="docutils literal notranslate"><span class="pre">echo</span></code> Echo Strings and Variables<a class="headerlink" href="#echo-echo-strings-and-variables" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>echo [-n] [<string|$name> [<string|$name>...]] |
| </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> |
| </section> |
| <section id="env-show-environment-variables"> |
| <span id="cmdenv"></span><h2><code class="docutils literal notranslate"><span class="pre">env</span></code> Show Environment Variables<a class="headerlink" href="#env-show-environment-variables" title="Permalink to this heading"></a></h2> |
| <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> env |
| PATH=/bin |
| |
| nsh> set foo bar |
| nsh> env |
| PATH=/bin |
| foo=bar |
| |
| nsh> unset PATH |
| nsh> env |
| foo=bar |
| |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="exec-execute-user-code"> |
| <span id="cmdexec"></span><h2><code class="docutils literal notranslate"><span class="pre">exec</span></code> Execute User Code<a class="headerlink" href="#exec-execute-user-code" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>exec <hex-address> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Execute the user logic at address <code class="docutils literal notranslate"><span class="pre"><hex-address></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"><hex-address></span> <span class="pre">&</span></code>.</p> |
| </section> |
| <section id="exit-exit-nsh"> |
| <span id="cmdexit"></span><h2><code class="docutils literal notranslate"><span class="pre">exit</span></code> Exit NSH<a class="headerlink" href="#exit-exit-nsh" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="export-set-an-environment-variable"> |
| <span id="cmdexport"></span><h2><code class="docutils literal notranslate"><span class="pre">export</span></code> Set an Environment Variable<a class="headerlink" href="#export-set-an-environment-variable" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>export <name> [<value>] |
| </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> env |
| PATH=/bin |
| |
| nsh> set foo bar |
| nsh> env |
| PATH=/bin |
| |
| nsh> export foo |
| nsh> 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> export dog poop |
| nsh> 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> |
| </section> |
| <section id="expr-evaluate-expressions"> |
| <span id="cmdexpr"></span><h2><code class="docutils literal notranslate"><span class="pre">expr</span></code> Evaluate expressions<a class="headerlink" href="#expr-evaluate-expressions" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>expr <operand1> <operator> <operand2> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. It is a mini version for the expr command, which implements the |
| features of addition, subtraction, multiplication, division and mod.</p> |
| <p><strong>Examples</strong>:</p> |
| <blockquote> |
| <div><p>nsh> expr 5 - 2 |
| 3 |
| nsh> set hello 10 |
| nsh> expr $hello - 2 |
| 8 |
| nsh> expr 8 a 9 |
| Unknown operator |
| nsh> expr 20 / 5 |
| 4 |
| nsh> expr 10 % 4 |
| 2 |
| nsh> expr 100 + 0 |
| 100</p> |
| </div></blockquote> |
| </section> |
| <section id="free-show-memory-manager-status"> |
| <span id="cmdfree"></span><h2><code class="docutils literal notranslate"><span class="pre">free</span></code> Show Memory Manager Status<a class="headerlink" href="#free-show-memory-manager-status" title="Permalink to this heading"></a></h2> |
| <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> free |
| total used free largest nused nfree |
| Mem: 5583024 1614784 3968240 3967792 244 4 |
| |
| nsh> |
| </pre></div> |
| </div> |
| <p><strong>Where:</strong></p> |
| <table class="docutils align-default"> |
| <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> |
| <tr class="row-odd"><td><p>nused</p></td> |
| <td><p>This is the number of allocated chunks</p></td> |
| </tr> |
| <tr class="row-even"><td><p>nfree</p></td> |
| <td><p>This is the number of free chunks</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="get-get-file-via-tftp"> |
| <span id="cmdget"></span><h2><code class="docutils literal notranslate"><span class="pre">get</span></code> Get File Via TFTP<a class="headerlink" href="#get-get-file-via-tftp" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Copy the file at <code class="docutils literal notranslate"><span class="pre"><remote-address></span></code> from the host |
| whose IP address is identified by <code class="docutils literal notranslate"><span class="pre"><ip-address></span></code>.</p> |
| <p><strong>Other options</strong></p> |
| <table class="docutils align-default"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre"><local-path></span></code></p></td> |
| <td><p>The file will be saved relative to the current working directory unless <local-path> 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> |
| </section> |
| <section id="help-show-usage-command-usage"> |
| <span id="cmdhelp"></span><h2><code class="docutils literal notranslate"><span class="pre">help</span></code> Show Usage Command Usage<a class="headerlink" href="#help-show-usage-command-usage" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>help [-v] [<cmd>] |
| </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"> |
| <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"><cmd></span></code></p></td> |
| <td><p>Show full command usage only for this command.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="hexdump-hexadecimal-dump-of-file-or-device"> |
| <span id="cmdhexdump"></span><h2><code class="docutils literal notranslate"><span class="pre">hexdump</span></code> Hexadecimal Dump of File or Device<a class="headerlink" href="#hexdump-hexadecimal-dump-of-file-or-device" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>hexdump <file or device> [skip=<bytes>] [count=<bytes>] |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Dump data in hexadecimal format from a file or |
| character device</p> |
| <table class="docutils align-default"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">skip=<bytes></span></code></p></td> |
| <td><p>Will skip <bytes> number of bytes from the beginning.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">count=<bytes></span></code></p></td> |
| <td><p>Will stop after dumping <bytes> 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> |
| </section> |
| <section id="ifconfig-manage-network-configuration"> |
| <span id="cmdifconfig"></span><h2><code class="docutils literal notranslate"><span class="pre">ifconfig</span></code> Manage Network Configuration<a class="headerlink" href="#ifconfig-manage-network-configuration" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifconfig [nic_name [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]] |
| </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> 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> mount -t procfs /proc |
| </pre></div> |
| </div> |
| </div> |
| </section> |
| <section id="ifdown-take-a-network-down"> |
| <span id="cmdifdown"></span><h2><code class="docutils literal notranslate"><span class="pre">ifdown</span></code> Take a network down<a class="headerlink" href="#ifdown-take-a-network-down" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifdown <interface> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Take down the interface identified by the name |
| <interface>.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifdown eth0 |
| </pre></div> |
| </div> |
| </section> |
| <section id="ifup-bring-a-network-up"> |
| <span id="cmdifup"></span><h2><code class="docutils literal notranslate"><span class="pre">ifup</span></code> Bring a network up<a class="headerlink" href="#ifup-bring-a-network-up" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifup <interface> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Bring up down the interface identified by the name |
| <interface>.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ifup eth0 |
| </pre></div> |
| </div> |
| </section> |
| <section id="insmod-install-an-os-module"> |
| <span id="cmdinsmod"></span><h2><code class="docutils literal notranslate"><span class="pre">insmod</span></code> Install an OS module<a class="headerlink" href="#insmod-install-an-os-module" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>insmod <file-path> <module-name> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Install the loadable OS module at <file-path> as |
| module <module-name>.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> ls -l /mnt/romfs |
| /mnt/romfs: |
| dr-xr-xr-x 0 . |
| -r-xr-xr-x 9153 chardev |
| nsh> 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> lsmod |
| NAME INIT UNINIT ARG TEXT SIZE DATA SIZE |
| nsh> insmod /mnt/romfs/chardev mydriver |
| nsh> 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> lsmod |
| NAME INIT UNINIT ARG TEXT SIZE DATA SIZE |
| mydriver 20404659 20404625 0 20404580 552 204047a8 0 |
| </pre></div> |
| </div> |
| </section> |
| <section id="irqinfo-show-interrupt-status"> |
| <span id="cmdirqinfo"></span><h2><code class="docutils literal notranslate"><span class="pre">irqinfo</span></code> Show Interrupt Status<a class="headerlink" href="#irqinfo-show-interrupt-status" title="Permalink to this heading"></a></h2> |
| <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> 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> |
| </section> |
| <section id="critmon-show-critical-monitor-status"> |
| <span id="cmdcritmon"></span><h2><code class="docutils literal notranslate"><span class="pre">critmon</span></code> Show Critical Monitor Status<a class="headerlink" href="#critmon-show-critical-monitor-status" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>critmon |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Show the preemption time, critical section time, |
| longest single run time, total run time, process ID (PID), |
| and thread description of each thread in the system.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> critmon |
| PRE-EMPTION CSECTION RUN TIME PID DESCRIPTION |
| 0.010265000 0.000037000 ----------- ------------ ---- CPU 0 |
| 0.000000000 0.000000000 0.001237000 28.421047000 0 Idle Task |
| 0.000011000 0.000037000 0.000046000 0.034211000 1 loop_task |
| 0.000000000 0.000028000 0.000067000 0.236657000 2 hpwork |
| </pre></div> |
| </div> |
| <p>In this example, the output shows the preemption time, critical section time, |
| longest single run time, total run time, and thread description for each |
| thread in the system.</p> |
| <p>The output of the <code class="docutils literal notranslate"><span class="pre">critmon</span></code> command displays the following columns:</p> |
| <ul class="simple"> |
| <li><p>PRE-EMPTION: Preemption time</p></li> |
| <li><p>CSECTION: Critical section time</p></li> |
| <li><p>RUN: Longest single run time of the thread</p></li> |
| <li><p>TIME: Total run time of the thread</p></li> |
| <li><p>PID: Process ID of the thread</p></li> |
| <li><p>DESCRIPTION: Thread description (name)</p></li> |
| </ul> |
| </section> |
| <section id="kill-send-a-signal-to-a-task"> |
| <span id="cmdkill"></span><h2><code class="docutils literal notranslate"><span class="pre">kill</span></code> Send a signal to a task<a class="headerlink" href="#kill-send-a-signal-to-a-task" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>kill -<signal> <pid> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Send the <signal> to the task identified by <pid>.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> mkfifo /dev/fifo |
| nsh> cat /dev/fifo & |
| cat [2:128] |
| nsh> 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 <pthread>(51ea50) |
| nsh> kill -9 2 |
| nsh> 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> |
| </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> |
| </section> |
| <section id="losetup-setup-teardown-the-loop-device"> |
| <span id="cmdlosetup"></span><h2><code class="docutils literal notranslate"><span class="pre">losetup</span></code> Setup/teardown the Loop Device<a class="headerlink" href="#losetup-setup-teardown-the-loop-device" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax 1</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>losetup [-o <offset>] [-r] <dev-path> <file-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Setup the loop device at <dev-path> to access the |
| file at <file-path> 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> dd if=/dev/zero of=/tmp/image bs=512 count=512 |
| nsh> ls -l /tmp |
| /tmp: |
| -rw-rw-rw- 262144 IMAGE |
| nsh> losetup /dev/loop0 /tmp/image |
| nsh> ls -l /dev |
| /dev: |
| brw-rw-rw- 0 loop0 |
| nsh> mkfatfs /dev/loop0 |
| nsh> mount -t vfat /dev/loop0 /mnt/example |
| nsh> ls -l /mnt |
| ls -l /mnt |
| /mnt: |
| drw-rw-rw- 0 example/ |
| nsh> echo "This is a test" >/mnt/example/atest.txt |
| nsh> ls -l /mnt/example |
| /mnt/example: |
| -rw-rw-rw- 16 ATEST.TXT |
| nsh> cat /mnt/example/atest.txt |
| This is a test |
| nsh> |
| </pre></div> |
| </div> |
| <p><strong>Command Syntax 2</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>losetup d <dev-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Teardown the setup for the loop device at |
| <dev-path>.</p> |
| </section> |
| <section id="ln-link-to-a-file-or-directory"> |
| <span id="cmdln"></span><h2><code class="docutils literal notranslate"><span class="pre">ln</span></code> Link to a File or Directory<a class="headerlink" href="#ln-link-to-a-file-or-directory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ln [-s] <target> <link> |
| </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 <link> for the existing file or directory, <target>. 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 internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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> |
| </section> |
| <section id="ls-list-directory-contents"> |
| <span id="cmdls"></span><h2><code class="docutils literal notranslate"><span class="pre">ls</span></code> List Directory Contents<a class="headerlink" href="#ls-list-directory-contents" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ls [-lRsh] <dir-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Show the contents of the directory at |
| <code class="docutils literal notranslate"><span class="pre"><dir-path></span></code>. NOTE: <code class="docutils literal notranslate"><span class="pre"><dir-path></span></code> must refer to a directory and |
| no other file system object.</p> |
| <p><strong>Options</strong></p> |
| <table class="docutils align-default"> |
| <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> |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-h</span></code></p></td> |
| <td><p>Show size and mode information along with the filenames in the listing with humanable.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="lsmod-show-information-about-installed-os-modules"> |
| <span id="cmdlsmod"></span><h2><code class="docutils literal notranslate"><span class="pre">lsmod</span></code> Show information about installed OS modules<a class="headerlink" href="#lsmod-show-information-about-installed-os-modules" title="Permalink to this heading"></a></h2> |
| <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> lsmod |
| NAME INIT UNINIT ARG TEXT SIZE DATA SIZE |
| mydriver 20404659 20404625 0 20404580 552 204047a8 0 |
| </pre></div> |
| </div> |
| </section> |
| <section id="md5-calculate-md5"> |
| <span id="cmdmd5"></span><h2><code class="docutils literal notranslate"><span class="pre">md5</span></code> Calculate MD5<a class="headerlink" href="#md5-calculate-md5" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>md5 [-f] <string or filepath> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. <em>To be provided.</em></p> |
| </section> |
| <section id="mb-mh-and-mw-access-memory"> |
| <span id="cmdmx"></span><h2><code class="docutils literal notranslate"><span class="pre">mb</span></code>, <code class="docutils literal notranslate"><span class="pre">mh</span></code>, <code class="docutils literal notranslate"><span class="pre">and</span></code> <code class="docutils literal notranslate"><span class="pre">mw</span></code> Access Memory<a class="headerlink" href="#mb-mh-and-mw-access-memory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mb <hex-address>[=<hex-value>][ <hex-byte-count>] |
| mh <hex-address>[=<hex-value>][ <hex-byte-count>] |
| mw <hex-address>[=<hex-value>][ <hex-byte-count>] |
| </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"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre"><hex-address></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"><hex-address>=<hex-value></span></code></p></td> |
| <td><p>Read the value, then write <hex-value> to the location.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre"><hex-byte-count></span></code></p></td> |
| <td><p>Perform the mb, mh, or mw operation on a total of |
| <hex-byte-count> bytes, increment the <hex-address> |
| 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> 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> |
| </pre></div> |
| </div> |
| </section> |
| <section id="ps-show-current-tasks-and-threads"> |
| <span id="cmdps"></span><h2><code class="docutils literal notranslate"><span class="pre">ps</span></code> Show Current Tasks and Threads<a class="headerlink" href="#ps-show-current-tasks-and-threads" title="Permalink to this heading"></a></h2> |
| <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> 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 <pthread>(21) |
| nsh> |
| </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> mount -t procfs /proc |
| </pre></div> |
| </div> |
| </section> |
| <section id="mkdir-create-a-directory"> |
| <span id="cmdmkdir"></span><h2><code class="docutils literal notranslate"><span class="pre">mkdir</span></code> Create a Directory<a class="headerlink" href="#mkdir-create-a-directory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkdir <path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Create the directory at <code class="docutils literal notranslate"><span class="pre"><path></span></code>. All components |
| of <code class="docutils literal notranslate"><span class="pre"><path></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 internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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 |
| <a class="reference internal" href="#cmdmount"><span class="std std-ref">mount</span></a> 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> mkdir /mnt/fs/tmp |
| nsh> ls -l /mnt/fs |
| /mnt/fs: |
| drw-rw-rw- 0 TESTDIR/ |
| drw-rw-rw- 0 TMP/ |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="mkfatfs-create-a-fat-file-system"> |
| <span id="cmdmkfatfs"></span><h2><code class="docutils literal notranslate"><span class="pre">mkfatfs</span></code> Create a FAT File System<a class="headerlink" href="#mkfatfs-create-a-fat-file-system" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong></p> |
| <blockquote> |
| <div><p>mkfatfs [-F <fatsize>] [-r <rootdirentries>] <block-driver></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"><block-driver></span></code> path. The FAT size may be provided |
| as an option. Without the <code class="docutils literal notranslate"><span class="pre"><fatsize></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> NuttX API. This block device must |
| reside in the NuttX <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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> |
| </section> |
| <section id="mkfifo-create-a-fifo"> |
| <span id="cmdmkfifo"></span><h2><code class="docutils literal notranslate"><span class="pre">mkfifo</span></code> Create a FIFO<a class="headerlink" href="#mkfifo-create-a-fifo" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkfifo <path> |
| </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"><path></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> NuttX API.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> ls -l /dev |
| /dev: |
| crw-rw-rw- 0 console |
| crw-rw-rw- 0 null |
| brw-rw-rw- 0 ram0 |
| nsh> mkfifo /dev/fifo |
| nsh> 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> |
| </pre></div> |
| </div> |
| </section> |
| <section id="mkrd-create-a-ramdisk"> |
| <span id="cmdmkrd"></span><h2><code class="docutils literal notranslate"><span class="pre">mkrd</span></code> Create a RAMDISK<a class="headerlink" href="#mkrd-create-a-ramdisk" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkrd [-m <minor>] [-s <sector-size>] <nsectors> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Create a ramdisk consisting of <code class="docutils literal notranslate"><span class="pre"><nsectors></span></code>, each |
| of size <code class="docutils literal notranslate"><span class="pre"><sector-size></span></code> (or 512 bytes if <code class="docutils literal notranslate"><span class="pre"><sector-size></span></code> is |
| not specified. The ramdisk will be registered as |
| <code class="docutils literal notranslate"><span class="pre">/dev/ram<minor></span></code>. If <code class="docutils literal notranslate"><span class="pre"><minor></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> ls /dev |
| /dev: |
| console |
| null |
| ttyS0 |
| ttyS1 |
| nsh> mkrd 1024 |
| nsh> ls /dev |
| /dev: |
| console |
| null |
| ram0 |
| ttyS0 |
| ttyS1 |
| nsh> |
| </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> mkrd 1024 |
| nsh> mkfatfs /dev/ram0 |
| nsh> mount -t vfat /dev/ram0 /tmp |
| nsh> ls /tmp |
| /tmp: |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="mount-mount-a-file-system"> |
| <span id="cmdmount"></span><h2><code class="docutils literal notranslate"><span class="pre">mount</span></code> Mount a File System<a class="headerlink" href="#mount-mount-a-file-system" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mount -t <fstype> [-o <options>] <block-device> <dir-path> |
| </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"><fstype></span></code>’ option identifies the |
| type of file system that has been formatted on the |
| <code class="docutils literal notranslate"><span class="pre"><block-device></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"><fstype></span></code></p></li> |
| <li><p><strong>Block Device.</strong> The <code class="docutils literal notranslate"><span class="pre"><block-device></span></code> argument is the full |
| or relative path to a block driver inode in the |
| <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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"><block-device></span></code> must have been previously formatted |
| with the same file system type as specified by <code class="docutils literal notranslate"><span class="pre"><fstype></span></code></p></li> |
| <li><p><strong>Mount Point.</strong> The mount point, <code class="docutils literal notranslate"><span class="pre"><dir-path></span></code>, is the |
| location in the <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></a> |
| where the mounted volume will appear. This mount point can only |
| reside in the NuttX |
| <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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 internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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> ls -l /dev |
| /dev: |
| crw-rw-rw- 0 console |
| crw-rw-rw- 0 null |
| brw-rw-rw- 0 ram0 |
| nsh> ls /mnt |
| nsh: ls: no such directory: /mnt |
| nsh> mount -t vfat /dev/ram0 /mnt/fs |
| nsh> ls -l /mnt/fs/testdir |
| /mnt/fs/testdir: |
| -rw-rw-rw- 15 TESTFILE.TXT |
| nsh> echo "This is a test" >/mnt/fs/testdir/example.txt |
| nsh> ls -l /mnt/fs/testdir |
| /mnt/fs/testdir: |
| -rw-rw-rw- 15 TESTFILE.TXT |
| -rw-rw-rw- 16 EXAMPLE.TXT |
| nsh> cat /mnt/fs/testdir/example.txt |
| This is a test |
| nsh> |
| </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> mount |
| /etc type romfs |
| /mnt/fs type vfat |
| /tmp type vfat |
| </pre></div> |
| </div> |
| </section> |
| <section id="mv-rename-a-file"> |
| <span id="cmdmv"></span><h2><code class="docutils literal notranslate"><span class="pre">mv</span></code> Rename a File<a class="headerlink" href="#mv-rename-a-file" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mv <old-path> <new-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Rename the file object at <code class="docutils literal notranslate"><span class="pre"><old-path></span></code> to |
| <code class="docutils literal notranslate"><span class="pre"><new-path></span></code>. Both paths must reside in the same mounted file |
| system.</p> |
| </section> |
| <section id="nfsmount-mount-an-nfs-file-system"> |
| <span id="cmdnfsmount"></span><h2><code class="docutils literal notranslate"><span class="pre">nfsmount</span></code> Mount an NFS file system<a class="headerlink" href="#nfsmount-mount-an-nfs-file-system" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nfsmount <server-address> <mount-point> <remote-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Mount the remote NFS server directory<remote-path> |
| at <mount-point> on the target machine. <server-address> is the IP |
| address of the remote server.</p> |
| </section> |
| <section id="nslookup-lookup-a-network-address"> |
| <span id="cmdnslookup"></span><h2><code class="docutils literal notranslate"><span class="pre">nslookup</span></code> Lookup a network address<a class="headerlink" href="#nslookup-lookup-a-network-address" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nslookup <host-name> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Lookup and print the IP address associated with |
| <code class="docutils literal notranslate"><span class="pre"><host-name></span></code>.</p> |
| </section> |
| <section id="passwd-change-a-user-s-password"> |
| <span id="cmdpasswd"></span><h2><code class="docutils literal notranslate"><span class="pre">passwd</span></code> Change a User’s Password<a class="headerlink" href="#passwd-change-a-user-s-password" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>passwd <username> <password> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Set the password for the existing user <username> to |
| <password>.</p> |
| </section> |
| <section id="pmconfig-manage-power-management-subsystem"> |
| <span id="cmdpmconfig"></span><h2><code class="docutils literal notranslate"><span class="pre">pmconfig</span></code> Manage Power Management Subsystem<a class="headerlink" href="#pmconfig-manage-power-management-subsystem" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="poweroff-shut-the-system-down"> |
| <span id="cmdpoweroff"></span><h2><code class="docutils literal notranslate"><span class="pre">poweroff</span></code> Shut the system down<a class="headerlink" href="#poweroff-shut-the-system-down" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>poweroff [<n>] |
| </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> |
| </section> |
| <section id="put-send-file-via-tftp"> |
| <span id="cmdput"></span><h2><code class="docutils literal notranslate"><span class="pre">put</span></code> Send File Via TFTP<a class="headerlink" href="#put-send-file-via-tftp" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Copy the file at <code class="docutils literal notranslate"><span class="pre"><local-address></span></code> to the host |
| whose IP address is identified by <code class="docutils literal notranslate"><span class="pre"><ip-address></span></code>.</p> |
| <p><strong>Other options:</strong></p> |
| <table class="docutils align-default"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre"><remote-path></span></code></p></td> |
| <td><p>The file will be saved relative with the same |
| name on the host unless <remote-path> 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> |
| </section> |
| <section id="pwd-show-current-working-directory"> |
| <span id="cmdpwd"></span><h2><code class="docutils literal notranslate"><span class="pre">pwd</span></code> Show Current Working Directory<a class="headerlink" href="#pwd-show-current-working-directory" title="Permalink to this heading"></a></h2> |
| <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> cd /dev |
| nsh> pwd |
| /dev |
| nsh> |
| </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> echo $PWD |
| /dev |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="readlink-show-target-of-a-link"> |
| <span id="cmdreadlink"></span><h2><code class="docutils literal notranslate"><span class="pre">readlink</span></code> Show target of a link<a class="headerlink" href="#readlink-show-target-of-a-link" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>readlink <link> |
| </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"><link></span></code>.</p> |
| </section> |
| <section id="reboot-reboot-the-system"> |
| <span id="cmdreboot"></span><h2><code class="docutils literal notranslate"><span class="pre">reboot</span></code> Reboot the system<a class="headerlink" href="#reboot-reboot-the-system" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>reboot [<n>] |
| </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 <n> 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> |
| </section> |
| <section id="rm-remove-a-file"> |
| <span id="cmdrm"></span><h2><code class="docutils literal notranslate"><span class="pre">rm</span></code> Remove a File<a class="headerlink" href="#rm-remove-a-file" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rm <file-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Remove the specified <code class="docutils literal notranslate"><span class="pre"><file-path></span></code> name from the |
| mounted file system. Recall that NuttX uses a |
| <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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 |
| <a class="reference internal" href="#cmdmount"><span class="std std-ref">mount</span></a> 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> ls /mnt/fs/testdir |
| /mnt/fs/testdir: |
| TESTFILE.TXT |
| EXAMPLE.TXT |
| nsh> rm /mnt/fs/testdir/example.txt |
| nsh> ls /mnt/fs/testdir |
| /mnt/fs/testdir: |
| TESTFILE.TXT |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="rmdir-remove-a-directory"> |
| <span id="cmdrmdir"></span><h2><code class="docutils literal notranslate"><span class="pre">rmdir</span></code> Remove a Directory<a class="headerlink" href="#rmdir-remove-a-directory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmdir <dir-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Remove the specified <code class="docutils literal notranslate"><span class="pre"><dir-path></span></code> directory from |
| the mounted file system. Recall that NuttX uses a |
| <a class="reference internal" href="../../reference/user/10_filesystem.html#file-system-overview"><span class="std std-ref">pseudo file system</span></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 <a class="reference internal" href="#cmdmount"><span class="std std-ref">mount</span></a> |
| 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> mkdir /mnt/fs/tmp |
| nsh> ls -l /mnt/fs |
| /mnt/fs: |
| drw-rw-rw- 0 TESTDIR/ |
| drw-rw-rw- 0 TMP/ |
| nsh> rmdir /mnt/fs/tmp |
| nsh> ls -l /mnt/fs |
| /mnt/fs: |
| drw-rw-rw- 0 TESTDIR/ |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="rmmod-remove-on-os-module"> |
| <span id="cmdrmmod"></span><h2><code class="docutils literal notranslate"><span class="pre">rmmod</span></code> Remove on OS Module<a class="headerlink" href="#rmmod-remove-on-os-module" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rmmod <module-name> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Remove the loadable OS module with the |
| <module-name>. 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> lsmod |
| NAME INIT UNINIT ARG TEXT SIZE DATA SIZE |
| mydriver 20404659 20404625 0 20404580 552 204047a8 0 |
| nsh> rmmod mydriver |
| nsh> lsmod |
| NAME INIT UNINIT ARG TEXT SIZE DATA SIZE |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="route-show-routing-table"> |
| <span id="cmdroute"></span><h2><code class="docutils literal notranslate"><span class="pre">route</span></code> Show routing table<a class="headerlink" href="#route-show-routing-table" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="rptun-start-stop-the-openamp-rpc-tunnel"> |
| <span id="cmdrptun"></span><h2><code class="docutils literal notranslate"><span class="pre">rptun</span></code> Start/Stop the OpenAMP RPC Tunnel<a class="headerlink" href="#rptun-start-stop-the-openamp-rpc-tunnel" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rptun start|stop <dev-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Start or stop the OpenAMP RPC tunnel device at <dev-path>.</p> |
| </section> |
| <section id="set-set-a-variable"> |
| <span id="cmdset"></span><h2><code class="docutils literal notranslate"><span class="pre">set</span></code> Set a Variable<a class="headerlink" href="#set-set-a-variable" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>set [{+|-}{e|x|xe|ex}] [<name> <value>] |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Set the variable <code class="docutils literal notranslate"><span class="pre"><name></span></code> to the string <code class="docutils literal notranslate"><span class="pre"><value></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> echo $foobar |
| |
| nsh> set foobar foovalue |
| nsh> echo $foobar |
| foovalue |
| nsh> |
| </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 <a class="reference internal" href="#cmdexport"><span class="std std-ref">export</span></a>, 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> 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> echo $foobar |
| foovalue |
| </pre></div> |
| </div> |
| </section> |
| <section id="sh-execute-an-nsh-script"> |
| <span id="cmdsh"></span><h2><code class="docutils literal notranslate"><span class="pre">sh</span></code> Execute an NSH Script<a class="headerlink" href="#sh-execute-an-nsh-script" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sh <script-path> |
| </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"><script-path></span></code>.</p> |
| </section> |
| <section id="shutdown-shut-the-system-down"> |
| <span id="cmdshutdown"></span><h2><code class="docutils literal notranslate"><span class="pre">shutdown</span></code> Shut the system down<a class="headerlink" href="#shutdown-shut-the-system-down" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="sleep-wait-for-seconds"> |
| <span id="cmdsleep"></span><h2><code class="docutils literal notranslate"><span class="pre">sleep</span></code> Wait for Seconds<a class="headerlink" href="#sleep-wait-for-seconds" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sleep <sec> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Pause execution (sleep) for <code class="docutils literal notranslate"><span class="pre"><sec></span></code> seconds.</p> |
| </section> |
| <section id="telnetd-time-start-the-telnet-daemon"> |
| <span id="cmdtelnetd"></span><h2><code class="docutils literal notranslate"><span class="pre">telnetd</span></code> Time Start the Telnet Daemon<a class="headerlink" href="#telnetd-time-start-the-telnet-daemon" title="Permalink to this heading"></a></h2> |
| <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 without |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_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> |
| </section> |
| <section id="time-time-execution-of-another-command"> |
| <span id="cmdtime"></span><h2><code class="docutils literal notranslate"><span class="pre">time</span></code> Time execution of another command<a class="headerlink" href="#time-time-execution-of-another-command" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>time "<command>" |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Perform command timing. This command will execute the |
| following <command> 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 |
| <command> 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> time "sleep 2" |
| |
| 2.0100 sec |
| nsh> |
| </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 preempted 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> time "sleep 2 &" |
| sleep [3:100] |
| |
| 0.0000 sec |
| nsh> |
| </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> time "sleep 2" & |
| time [3:100] |
| nsh> |
| 2.0100 sec |
| </pre></div> |
| </div> |
| </section> |
| <section id="truncate-set-the-size-of-a-file"> |
| <span id="cmdtruncate"></span><h2><code class="docutils literal notranslate"><span class="pre">truncate</span></code> Set the Size of a File<a class="headerlink" href="#truncate-set-the-size-of-a-file" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>truncate -s <length> <file-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Shrink or extend the size of the regular file at |
| <file-path> to the specified<length>.</p> |
| <p>A <file-path> argument that does not exist is created. The <length> |
| option is NOT optional.</p> |
| <p>If a <file-path> is larger than the specified size, the extra data is |
| lost. If a <file-path> is shorter, it is extended and the extended part |
| reads as zero bytes.</p> |
| </section> |
| <section id="umount-unmount-a-file-system"> |
| <span id="cmdumount"></span><h2><code class="docutils literal notranslate"><span class="pre">umount</span></code> Unmount a File System<a class="headerlink" href="#umount-unmount-a-file-system" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>umount <dir-path> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Un-mount the file system at mount point <code class="docutils literal notranslate"><span class="pre"><dir-path></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 <a class="reference internal" href="#cmdmount"><span class="std std-ref">mount</span></a> command.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> ls /mnt/fs |
| /mnt/fs: |
| TESTDIR/ |
| nsh> umount /mnt/fs |
| nsh> ls /mnt/fs |
| /mnt/fs: |
| nsh: ls: no such directory: /mnt/fs |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="uname-print-system-information"> |
| <span id="cmduname"></span><h2><code class="docutils literal notranslate"><span class="pre">uname</span></code> Print system information<a class="headerlink" href="#uname-print-system-information" title="Permalink to this heading"></a></h2> |
| <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"> |
| <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> |
| </section> |
| <section id="unset-unset-an-environment-variable"> |
| <span id="cmdunset"></span><h2><code class="docutils literal notranslate"><span class="pre">unset</span></code> Unset an Environment Variable<a class="headerlink" href="#unset-unset-an-environment-variable" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <blockquote> |
| <div><p>unset <name></p> |
| </div></blockquote> |
| <p><strong>Synopsis</strong>. Remove the value associated with the variable <code class="docutils literal notranslate"><span class="pre"><name></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> echo $foobar |
| foovalue |
| nsh> unset foobar |
| nsh> echo $foobar |
| |
| nsh> |
| </pre></div> |
| </div> |
| </section> |
| <section id="uptime-show-how-long-the-system-has-been-running"> |
| <span id="cmduptime"></span><h2><code class="docutils literal notranslate"><span class="pre">uptime</span></code> Show how long the system has been running<a class="headerlink" href="#uptime-show-how-long-the-system-has-been-running" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <blockquote> |
| <div><p>uptime [-sph]</p> |
| </div></blockquote> |
| <p><strong>Synopsis</strong>. Display of the following information: the current time, |
| how long the system has been running, and the load averages for the past 1, 5, |
| and 15 minutes.</p> |
| <p><strong>Options</strong></p> |
| <table class="docutils align-default"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-p</span></code></p></td> |
| <td><p>show uptime in pretty format</p></td> |
| </tr> |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">-s</span></code></p></td> |
| <td><p>system up since</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-h</span></code></p></td> |
| <td><p>display this help and exit</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="urldecode-url-decode"> |
| <span id="cmdurldecode"></span><h2><code class="docutils literal notranslate"><span class="pre">urldecode</span></code> URL Decode<a class="headerlink" href="#urldecode-url-decode" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>urldecode [-f] <string or filepath> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. <em>To be provided.</em></p> |
| </section> |
| <section id="urlencode-url-encode"> |
| <span id="cmdurlencode"></span><h2><code class="docutils literal notranslate"><span class="pre">urlencode</span></code> URL Encode<a class="headerlink" href="#urlencode-url-encode" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>urlencode [-f] <string or filepath> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. <em>To be provided.</em></p> |
| </section> |
| <section id="useradd-add-a-new-user"> |
| <span id="cmduseradd"></span><h2><code class="docutils literal notranslate"><span class="pre">useradd</span></code> Add a New User<a class="headerlink" href="#useradd-add-a-new-user" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>useradd <username> <password> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Add a new user with <username> and <password>.</p> |
| </section> |
| <section id="userdel-delete-a-user"> |
| <span id="cmduserdel"></span><h2><code class="docutils literal notranslate"><span class="pre">userdel</span></code> Delete a user<a class="headerlink" href="#userdel-delete-a-user" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>userdel <username> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Delete the user with the name <username>.</p> |
| </section> |
| <section id="usleep-wait-for-microseconds"> |
| <span id="cmdusleep"></span><h2><code class="docutils literal notranslate"><span class="pre">usleep</span></code> Wait for Microseconds<a class="headerlink" href="#usleep-wait-for-microseconds" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>usleep <usec> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Pause execution (sleep) of <code class="docutils literal notranslate"><span class="pre"><usec></span></code> microseconds.</p> |
| </section> |
| <section id="wget-get-file-via-http"> |
| <span id="cmdwget"></span><h2><code class="docutils literal notranslate"><span class="pre">wget</span></code> Get File Via HTTP<a class="headerlink" href="#wget-get-file-via-http" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong></p> |
| <blockquote> |
| <div><p>wget [-o <local-path>] <url></p> |
| </div></blockquote> |
| <p><strong>Synopsis</strong>. Use HTTP to copy the file at <code class="docutils literal notranslate"><span class="pre"><url></span></code> to the current |
| directory.</p> |
| <p><strong>Options</strong></p> |
| <table class="docutils align-default"> |
| <tbody> |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">-o</span> <span class="pre"><local-path></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 <local-path> is provided.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </section> |
| <section id="xd-hexadecimal-dump-of-memory"> |
| <span id="cmdxd"></span><h2><code class="docutils literal notranslate"><span class="pre">xd</span></code> Hexadecimal Dump of Memory<a class="headerlink" href="#xd-hexadecimal-dump-of-memory" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>xd <hex-address> <byte-count> |
| </pre></div> |
| </div> |
| <p><strong>Synopsis</strong>. Dump <code class="docutils literal notranslate"><span class="pre"><byte-count></span></code> bytes of data from address |
| <code class="docutils literal notranslate"><span class="pre"><hex-address></span></code>.</p> |
| <p><strong>Example</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh> 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> |
| </pre></div> |
| </div> |
| </section> |
| <section id="built-in-commands"> |
| <h2>Built-In Commands<a class="headerlink" href="#built-in-commands" title="Permalink to this heading"></a></h2> |
| <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> |
| </section> |
| <section id="ping-and-ping6-check-network-peer"> |
| <span id="cmdping"></span><h2><code class="docutils literal notranslate"><span class="pre">ping</span></code> and <code class="docutils literal notranslate"><span class="pre">ping6</span></code> Check Network Peer<a class="headerlink" href="#ping-and-ping6-check-network-peer" title="Permalink to this heading"></a></h2> |
| <p><strong>Command Syntax</strong>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ping [-c <count>] [-i <interval>] <ip-address> |
| ping6 [-c <count>] [-i <interval>] <ip-address> |
| </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> 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> |
| </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> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="nsh.html" class="btn btn-neutral float-left" title="Overview" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="config.html" class="btn btn-neutral float-right" title="Configuration Settings" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |